Skip to content

Commit

Permalink
Merge pull request #2474 from Holzhaus/dont-stop-track-on-unconfigure…
Browse files Browse the repository at this point in the history
…d-passthru

engine/enginedeck: Don't stop playback if no passthru input is configured
  • Loading branch information
daschuer authored Feb 4, 2020
2 parents fb5dfa2 + bed4a87 commit 03307e7
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
13 changes: 13 additions & 0 deletions src/engine/enginedeck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ EngineDeck::EngineDeck(const ChannelHandleAndGroup& handle_group,
m_bPassthroughIsActive = false;
m_bPassthroughWasActive = false;

// Ensure that input is configured before enabling passthrough
m_pPassing->connectValueChangeRequest(
this, SLOT(slotPassthroughChangeRequest(double)),
Qt::DirectConnection);

// Set up passthrough toggle button
connect(m_pPassing, SIGNAL(valueChanged(double)),
this, SLOT(slotPassingToggle(double)),
Expand Down Expand Up @@ -163,3 +168,11 @@ bool EngineDeck::isPassthroughActive() const {
void EngineDeck::slotPassingToggle(double v) {
m_bPassthroughIsActive = v > 0;
}

void EngineDeck::slotPassthroughChangeRequest(double v) {
if (v <= 0 || m_pInputConfigured->get() > 0) {
m_pPassing->setAndConfirm(v);
} else {
emit noPassthroughInputConfigured();
}
}
4 changes: 4 additions & 0 deletions src/engine/enginedeck.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,12 @@ class EngineDeck : public EngineChannel, public AudioDestination {
// Return whether or not passthrough is active
bool isPassthroughActive() const;

signals:
void noPassthroughInputConfigured();

public slots:
void slotPassingToggle(double v);
void slotPassthroughChangeRequest(double v);

private:
UserSettingsPointer m_pConfig;
Expand Down
14 changes: 0 additions & 14 deletions src/mixer/basetrackplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ BaseTrackPlayerImpl::BaseTrackPlayerImpl(QObject* pParent,
pEffectsManager, defaultOrientation);

m_pInputConfigured = std::make_unique<ControlProxy>(group, "input_configured", this);
m_pPassthroughEnabled = std::make_unique<ControlProxy>(group, "passthrough", this);
m_pPassthroughEnabled->connectValueChanged(SLOT(slotPassthroughEnabled(double)));
#ifdef __VINYLCONTROL__
m_pVinylControlEnabled = std::make_unique<ControlProxy>(group, "vinylcontrol_enabled", this);
m_pVinylControlEnabled->connectValueChanged(SLOT(slotVinylControlEnabled(double)));
Expand Down Expand Up @@ -408,18 +406,6 @@ void BaseTrackPlayerImpl::setupEqControls() {
m_pPitchAdjust = std::make_unique<ControlProxy>(group, "pitch_adjust", this);
}

void BaseTrackPlayerImpl::slotPassthroughEnabled(double v) {
bool configured = m_pInputConfigured->toBool();
bool passthrough = v > 0.0;

// Warn the user if they try to enable passthrough on a player with no
// configured input.
if (!configured && passthrough) {
m_pPassthroughEnabled->set(0.0);
emit(noPassthroughInputConfigured());
}
}

void BaseTrackPlayerImpl::slotVinylControlEnabled(double v) {
#ifdef __VINYLCONTROL__
bool configured = m_pInputConfigured->toBool();
Expand Down
3 changes: 0 additions & 3 deletions src/mixer/basetrackplayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class BaseTrackPlayer : public BasePlayer {
void newTrackLoaded(TrackPointer pLoadedTrack);
void loadingTrack(TrackPointer pNewTrack, TrackPointer pOldTrack);
void playerEmpty();
void noPassthroughInputConfigured();
void noVinylControlInputConfigured();
};

Expand Down Expand Up @@ -78,7 +77,6 @@ class BaseTrackPlayerImpl : public BaseTrackPlayer {
void slotPlayToggled(double);

private slots:
void slotPassthroughEnabled(double v);
void slotVinylControlEnabled(double v);
void slotWaveformZoomValueChangeRequest(double pressed);
void slotWaveformZoomUp(double pressed);
Expand Down Expand Up @@ -129,7 +127,6 @@ class BaseTrackPlayerImpl : public BaseTrackPlayer {
std::unique_ptr<ControlProxy> m_pRateSlider;
std::unique_ptr<ControlProxy> m_pPitchAdjust;
std::unique_ptr<ControlProxy> m_pInputConfigured;
std::unique_ptr<ControlProxy> m_pPassthroughEnabled;
std::unique_ptr<ControlProxy> m_pVinylControlEnabled;
std::unique_ptr<ControlProxy> m_pVinylControlStatus;
};
Expand Down
4 changes: 2 additions & 2 deletions src/mixer/playermanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,8 @@ void PlayerManager::addDeckInner() {

Deck* pDeck = new Deck(this, m_pConfig, m_pEngine, m_pEffectsManager,
orientation, group);
connect(pDeck, SIGNAL(noPassthroughInputConfigured()),
this, SIGNAL(noDeckPassthroughInputConfigured()));
connect(pDeck->getEngineDeck(), &EngineDeck::noPassthroughInputConfigured,
this, &PlayerManager::noDeckPassthroughInputConfigured);
connect(pDeck, SIGNAL(noVinylControlInputConfigured()),
this, SIGNAL(noVinylControlInputConfigured()));

Expand Down

0 comments on commit 03307e7

Please sign in to comment.