Skip to content

Commit

Permalink
Prefer old explicit leader as soft leader after disabling it.
Browse files Browse the repository at this point in the history
  • Loading branch information
daschuer committed Sep 30, 2023
1 parent ef420c0 commit a35cddf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/engine/sync/enginesync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ void EngineSync::requestSyncMode(Syncable* pSyncable, SyncMode mode) {
// decks that need to change as a result.
Syncable* oldLeader = m_pLeaderSyncable;
switch (mode) {
case SyncMode::LeaderExplicit:
case SyncMode::LeaderSoft: {
case SyncMode::LeaderExplicit: {
if (pSyncable->getBaseBpm().isValid()) {
activateLeader(pSyncable, mode);
} else {
Expand All @@ -58,6 +57,15 @@ void EngineSync::requestSyncMode(Syncable* pSyncable, SyncMode mode) {
}
break;
}
case SyncMode::LeaderSoft: {
if (pSyncable->getBaseBpm().isValid() &&
pSyncable->isPlaying() &&
pSyncable->isAudible()) {
activateLeader(pSyncable, mode);
break;
}
[[fallthrough]];
}
case SyncMode::Follower: {
Syncable* pNewLeader = pickNewLeader(pSyncable);
if (pNewLeader == pSyncable) {
Expand Down
2 changes: 2 additions & 0 deletions src/engine/sync/synccontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,8 @@ void SyncControl::slotSyncLeaderEnabledChangeRequest(double state) {
// Turning off leader goes back to follower mode.
switch (mode) {
case SyncMode::LeaderExplicit:
m_pChannel->getEngineBuffer()->requestSyncMode(SyncMode::LeaderSoft);
break;
case SyncMode::LeaderSoft:
m_pChannel->getEngineBuffer()->requestSyncMode(SyncMode::Follower);
break;
Expand Down

0 comments on commit a35cddf

Please sign in to comment.