From 72f41a0208ed5c36fa092b8a87f899c46e2af551 Mon Sep 17 00:00:00 2001 From: ronso0 Date: Wed, 23 Sep 2020 17:12:41 +0200 Subject: [PATCH] loopcontrol: prevent moving a loop beyond track end --- src/engine/controls/loopingcontrol.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/engine/controls/loopingcontrol.cpp b/src/engine/controls/loopingcontrol.cpp index fbce5c8a8d5a..cfbca1f26c80 100644 --- a/src/engine/controls/loopingcontrol.cpp +++ b/src/engine/controls/loopingcontrol.cpp @@ -1245,6 +1245,11 @@ void LoopingControl::slotLoopMove(double beats) { pBeats->findNBeatsFromSample(new_loop_in, m_pCOBeatLoopSize->get()) : pBeats->findNBeatsFromSample(loopSamples.end, beats); + // the track would stop as soon as the playhead crosses track end, + // so don't allow moving a loop beyond end. + if (new_loop_out > m_pTrackSamples->get()) { + return; + } // If we are looping make sure that the play head does not leave the // loop as a result of our adjustment. loopSamples.seek = m_bLoopingEnabled;