From 38af58d29cc76f8052ac21b019f500621285780e Mon Sep 17 00:00:00 2001 From: ronso0 Date: Fri, 27 Oct 2023 00:05:46 +0200 Subject: [PATCH 1/2] (fix) Looping: reset loop_end_pos on eject --- src/engine/controls/loopingcontrol.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/engine/controls/loopingcontrol.cpp b/src/engine/controls/loopingcontrol.cpp index 0589d176815..7318f37b4fe 100644 --- a/src/engine/controls/loopingcontrol.cpp +++ b/src/engine/controls/loopingcontrol.cpp @@ -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; } From 7c9254b6bb4a2f3eb1d6089a92b105ef51eaff6a Mon Sep 17 00:00:00 2001 From: ronso0 Date: Fri, 27 Oct 2023 01:48:30 +0200 Subject: [PATCH 2/2] Test: eject should reset loop_start/end_pos --- src/test/looping_control_test.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/test/looping_control_test.cpp b/src/test/looping_control_test.cpp index 58557d5a1de..ff3eeafd0fc 100644 --- a/src/test/looping_control_test.cpp +++ b/src/test/looping_control_test.cpp @@ -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