Skip to content

Commit

Permalink
Merge pull request #4793 from ronso0/waveform-passthrough-enabled
Browse files Browse the repository at this point in the history
passthrough: stop rendering waveforms, disable Cue/Play indicators
  • Loading branch information
daschuer authored Jun 13, 2022
2 parents ebb98db + 1b0fb5e commit 2441b17
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/engine/enginebuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,12 @@ void EngineBuffer::slotPassthroughChanged(double enabled) {
if (enabled != 0) {
// If passthrough was enabled, stop playing the current track.
slotControlStop(1.0);
// Disable CUE and Play indicators
m_pCueControl->resetIndicators();
} else {
// Update CUE and Play indicators. Note: m_pCueControl->updateIndicators()
// is not sufficient.
updateIndicatorsAndModifyPlay(false, false);
}
}

Expand Down Expand Up @@ -1242,6 +1248,15 @@ void EngineBuffer::postProcess(const int iBufferSize) {
}

void EngineBuffer::updateIndicators(double speed, int iBufferSize) {
// Explicitly invalidate the visual playposition so waveformwidgetrenderer
// clears the visual when passthrough was activated while a track was loaded.
// TODO(ronso0) Check if postProcess() needs to be called at all when passthrough
// is active -- if no, remove this hack.
if (m_pPassthroughEnabled->toBool()) {
m_visualPlayPos->setInvalid();
return;
}

if (m_filepos_play == kInitialSamplePosition ||
m_trackSampleRateOld == 0 ||
m_tempo_ratio_old == 0) {
Expand All @@ -1261,7 +1276,7 @@ void EngineBuffer::updateIndicators(double speed, int iBufferSize) {

const double tempoTrackSeconds = m_trackSamplesOld / kSamplesPerFrame
/ m_trackSampleRateOld / m_tempo_ratio_old;
if(speed > 0 && fFractionalPlaypos == 1.0) {
if (speed > 0 && fFractionalPlaypos == 1.0) {
// At Track end
speed = 0;
}
Expand Down

0 comments on commit 2441b17

Please sign in to comment.