Skip to content

Commit

Permalink
Do not create a new loop if it's the same as an existing loop
Browse files Browse the repository at this point in the history
This works around #11003 in which the adjustment of the spinbox creates a new loop, causing a sudden unexpected seek
  • Loading branch information
ywwg committed Oct 25, 2022
1 parent 6843184 commit dcf034d
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/engine/controls/loopingcontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1400,16 +1400,20 @@ void LoopingControl::slotBeatLoop(double beats, bool keepStartPoint, bool enable
return;
}

// If resizing an inactive loop by changing beatloop_size,
// do not seek to the adjusted loop.
newloopInfo.seekMode = (keepStartPoint && (enable || m_bLoopingEnabled))
? LoopSeekMode::Changed
: LoopSeekMode::MovedOut;

m_loopInfo.setValue(newloopInfo);
emit loopUpdated(newloopInfo.startPosition, newloopInfo.endPosition);
m_pCOLoopStartPosition->set(newloopInfo.startPosition.toEngineSamplePos());
m_pCOLoopEndPosition->set(newloopInfo.endPosition.toEngineSamplePos());
// Only create a new loop if the start and end position have changed.
if (loopInfo.startPosition != newloopInfo.startPosition ||
loopInfo.endPosition != newloopInfo.endPosition) {
// If resizing an inactive loop by changing beatloop_size,
// do not seek to the adjusted loop.
newloopInfo.seekMode = (keepStartPoint && (enable || m_bLoopingEnabled))
? LoopSeekMode::Changed
: LoopSeekMode::MovedOut;

m_loopInfo.setValue(newloopInfo);
emit loopUpdated(newloopInfo.startPosition, newloopInfo.endPosition);
m_pCOLoopStartPosition->set(newloopInfo.startPosition.toEngineSamplePos());
m_pCOLoopEndPosition->set(newloopInfo.endPosition.toEngineSamplePos());
}

if (enable) {
setLoopingEnabled(true);
Expand Down

0 comments on commit dcf034d

Please sign in to comment.