Skip to content

Commit

Permalink
Merge pull request #12224 from ronso0/looping-invalidate-end-pos-on-e…
Browse files Browse the repository at this point in the history
…ject

(fix) Looping: reset loop_end_pos on eject
  • Loading branch information
daschuer committed Oct 28, 2023
2 parents d936830 + 7c9254b commit 950bac8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/engine/controls/loopingcontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1107,8 +1107,8 @@ void LoopingControl::slotLoopEndPos(double positionSamples) {

// Reject if the loop-in is not set, or if the new position is before the
// start point (but not -1).
if (!loopInfo.startPosition.isValid() ||
(position.isValid() && position <= loopInfo.startPosition)) {
if (position.isValid() &&
(!loopInfo.startPosition.isValid() || position <= loopInfo.startPosition)) {
m_pCOLoopEndPosition->set(loopInfo.endPosition.toEngineSamplePosMaybeInvalid());
return;
}
Expand Down
8 changes: 8 additions & 0 deletions src/test/looping_control_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,14 @@ TEST_F(LoopingControlTest, LoopResizeSeek) {
EXPECT_FRAMEPOS_EQ(mixxx::audio::FramePos{250}, currentFramePos());
}

TEST_F(LoopingControlTest, EjectResetsLoopInOutPositions) {
m_pLoopStartPoint->set(mixxx::audio::kStartFramePos.toEngineSamplePos());
m_pLoopEndPoint->set(mixxx::audio::FramePos{300}.toEngineSamplePos());
m_pChannel1->getEngineBuffer()->ejectTrack();
EXPECT_FRAMEPOS_EQ_CONTROL(mixxx::audio::kInvalidFramePos, m_pLoopStartPoint);
EXPECT_FRAMEPOS_EQ_CONTROL(mixxx::audio::kInvalidFramePos, m_pLoopEndPoint);
}

TEST_F(LoopingControlTest, BeatLoopSize_SetAndToggle) {
m_pTrack1->trySetBpm(120.0);
// Setting beatloop_size should not activate a loop
Expand Down

0 comments on commit 950bac8

Please sign in to comment.