Skip to content

Commit

Permalink
process one more buffer after eject
Browse files Browse the repository at this point in the history
  • Loading branch information
daschuer committed Mar 29, 2022
1 parent 2d2bb6c commit dff90d2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
4 changes: 3 additions & 1 deletion src/engine/cachingreader/cachingreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,9 @@ void CachingReader::process() {
// track is already loading! In this case the TRACK_LOADED will
// be the very next status update.
if (!m_state.testAndSetRelease(STATE_TRACK_UNLOADING, STATE_IDLE)) {
DEBUG_ASSERT(atomicLoadRelaxed(m_state) == STATE_TRACK_LOADING);
DEBUG_ASSERT(
atomicLoadRelaxed(m_state) == STATE_TRACK_LOADING ||
atomicLoadRelaxed(m_state) == STATE_IDLE);
}
}
}
Expand Down
31 changes: 17 additions & 14 deletions src/engine/enginebuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1000,18 +1000,23 @@ void EngineBuffer::processTrackLocked(
rate = m_rate_old;
}

const mixxx::audio::FramePos trackEndPosition = getTrackEndPosition();
bool atEnd = m_playPosition >= trackEndPosition;
bool backwards = rate < 0;

bool bCurBufferPaused = false;
if (atEnd && !backwards) {
// do not play past end
bCurBufferPaused = true;
} else if (rate == 0 && !is_scratching) {
// do not process samples if have no transport
// the linear scaler supports ramping down to 0
// this is used for pause by scratching only
bool atEnd = false;
bool backwards = rate < 0;
const mixxx::audio::FramePos trackEndPosition = getTrackEndPosition();
if (trackEndPosition.isValid()) {
atEnd = m_playPosition >= trackEndPosition;
if (atEnd && !backwards) {
// do not play past end
bCurBufferPaused = true;
} else if (rate == 0 && !is_scratching) {
// do not process samples if have no transport
// the linear scaler supports ramping down to 0
// this is used for pause by scratching only
bCurBufferPaused = true;
}
} else {
// Track has already been ejected.
bCurBufferPaused = true;
}

Expand Down Expand Up @@ -1072,12 +1077,10 @@ void EngineBuffer::processTrackLocked(

// Handle repeat mode
const bool atStart = m_playPosition <= mixxx::audio::kStartFramePos;
atEnd = m_playPosition >= trackEndPosition;

bool repeat_enabled = m_pRepeat->toBool();

bool end_of_track = //(at_start && backwards) ||
(atEnd && !backwards);
bool end_of_track = atEnd && !backwards;

// If playbutton is pressed, check if we are at start or end of track
if ((m_playButton->toBool() || (m_fwdButton->toBool() || m_backButton->toBool()))
Expand Down
5 changes: 0 additions & 5 deletions src/engine/enginemaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,11 +300,6 @@ void EngineMaster::processChannels(int iBufferSize) {
continue;
}

if (activeState == EngineChannel::ActiveState::WasActive) {
// TODO() Clean up effect buffers.
continue;
}

if (pChannel->isTalkoverEnabled() &&
!pChannelInfo->m_pMuteControl->toBool()) {
// talkover is an exclusive channel
Expand Down

0 comments on commit dff90d2

Please sign in to comment.