Skip to content

Commit

Permalink
CueControl: dis/reconnect cue controls when passthrough is toggled
Browse files Browse the repository at this point in the history
  • Loading branch information
ronso0 committed Jul 2, 2022
1 parent 20a7cc5 commit 1e797bb
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
46 changes: 46 additions & 0 deletions src/engine/controls/cuecontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,52 @@ void CueControl::connectControls() {
}
}

void CueControl::disconnectCueControls() {
disconnect(m_pCueSet, nullptr, this, nullptr);
disconnect(m_pCueClear, nullptr, this, nullptr);
disconnect(m_pCueGoto, nullptr, this, nullptr);
disconnect(m_pCueGotoAndPlay, nullptr, this, nullptr);
disconnect(m_pCuePlay, nullptr, this, nullptr);
disconnect(m_pCueGotoAndStop, nullptr, this, nullptr);
disconnect(m_pCuePreview, nullptr, this, nullptr);
disconnect(m_pCueCDJ, nullptr, this, nullptr);
disconnect(m_pCueDefault, nullptr, this, nullptr);
disconnect(m_pPlayStutter, nullptr, this, nullptr);

disconnect(m_pIntroStartSet, nullptr, this, nullptr);
disconnect(m_pIntroStartClear, nullptr, this, nullptr);
disconnect(m_pIntroStartActivate, nullptr, this, nullptr);
disconnect(m_pIntroEndSet, nullptr, this, nullptr);
disconnect(m_pIntroEndClear, nullptr, this, nullptr);
disconnect(m_pIntroEndActivate, nullptr, this, nullptr);

disconnect(m_pOutroStartSet, nullptr, this, nullptr);
disconnect(m_pOutroStartClear, nullptr, this, nullptr);
disconnect(m_pOutroStartActivate, nullptr, this, nullptr);
disconnect(m_pOutroEndSet, nullptr, this, nullptr);
disconnect(m_pOutroEndClear, nullptr, this, nullptr);
disconnect(m_pOutroEndActivate, nullptr, this, nullptr);

disconnect(m_pHotcueFocusColorPrev, nullptr, this, nullptr);
disconnect(m_pHotcueFocusColorNext, nullptr, this, nullptr);

for (const auto& pControl : qAsConst(m_hotcueControls)) {
disconnect(pControl, nullptr, this, nullptr);
}
}

void CueControl::passthroughChanged(double enabled) {
if (enabled > 0) {
// If passthrough was enabled seeking and playing is prohibited, and the
// waveform and overview are blocked.
// Disconnect all cue controls to prevent cue changes without UI feedback.
disconnectCueControls();
} else {
// Reconnect all controls when deck returns to regular mode.
connectCueControls();
}
}

void CueControl::attachCue(const CuePointer& pCue, HotcueControl* pControl) {
VERIFY_OR_DEBUG_ASSERT(pControl) {
return;
Expand Down
6 changes: 6 additions & 0 deletions src/engine/controls/cuecontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ class CueControl : public EngineControl {
void hotcueFocusColorNext(double v);
void hotcueFocusColorPrev(double v);

void passthroughChanged(double v);

void cueSet(double v);
void cueClear(double v);
void cueGoto(double v);
Expand Down Expand Up @@ -270,6 +272,8 @@ class CueControl : public EngineControl {
// These methods are not thread safe, only call them when the lock is held.
void createControls();
void connectControls();
void disconnectControls();

void attachCue(const CuePointer& pCue, HotcueControl* pControl);
void detachCue(HotcueControl* pControl);
void setCurrentSavedLoopControlAndActivate(HotcueControl* pControl);
Expand Down Expand Up @@ -347,6 +351,8 @@ class CueControl : public EngineControl {
ControlObject* m_pHotcueFocusColorNext;
ControlObject* m_pHotcueFocusColorPrev;

ControlProxy* m_pPassthrough;

QAtomicPointer<HotcueControl> m_pCurrentSavedLoopControl;

// Tells us which controls map to which hotcue
Expand Down

0 comments on commit 1e797bb

Please sign in to comment.