From ce297e14bd284fbe5048808029d9904e85a47ab8 Mon Sep 17 00:00:00 2001 From: Joerg Date: Tue, 9 Jan 2024 21:54:10 +0100 Subject: [PATCH 1/2] Fix for not moving the playpos when LoopOut button is hold down and the playpos is near the end of the loop (or the same for LoopIn, while playing reverse) --- src/engine/controls/loopingcontrol.h | 6 ++++++ src/engine/enginebuffer.cpp | 4 ++++ src/waveform/visualplayposition.cpp | 12 ++++++++++-- src/waveform/visualplayposition.h | 4 ++++ 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/engine/controls/loopingcontrol.h b/src/engine/controls/loopingcontrol.h index f5161275e63..96167a41927 100644 --- a/src/engine/controls/loopingcontrol.h +++ b/src/engine/controls/loopingcontrol.h @@ -78,6 +78,12 @@ class LoopingControl : public EngineControl { bool isLoopingEnabled() { return m_bLoopingEnabled; } + bool isAdjustLoopInActive() { + return m_bAdjustingLoopIn; + } + bool isAdjustLoopOutActive() { + return m_bAdjustingLoopOut; + } bool isLoopRollActive() { return m_bLoopRollActive; } diff --git a/src/engine/enginebuffer.cpp b/src/engine/enginebuffer.cpp index 97874b0e946..65472a1f0eb 100644 --- a/src/engine/enginebuffer.cpp +++ b/src/engine/enginebuffer.cpp @@ -583,6 +583,8 @@ void EngineBuffer::ejectTrack() { 0.0, SlipModeState::Disabled, false, + false, + false, 0.0, 0.0, 0.0, @@ -1438,6 +1440,8 @@ void EngineBuffer::updateIndicators(double speed, int iBufferSize) { effectiveSlipRate, m_slipModeState, m_pLoopingControl->isLoopingEnabled(), + m_pLoopingControl->isAdjustLoopInActive(), + m_pLoopingControl->isAdjustLoopOutActive(), fFractionalLoopStartPos, fFractionalLoopEndPos, tempoTrackSeconds, diff --git a/src/waveform/visualplayposition.cpp b/src/waveform/visualplayposition.cpp index 973532ef0a7..54c919641de 100644 --- a/src/waveform/visualplayposition.cpp +++ b/src/waveform/visualplayposition.cpp @@ -29,6 +29,8 @@ void VisualPlayPosition::set( double slipRate, SlipModeState m_slipModeState, bool loopEnabled, + bool loopInAdjustActive, + bool loopOutAdjustActive, double loopStartPosition, double loopEndPosition, double tempoTrackSeconds, @@ -43,6 +45,8 @@ void VisualPlayPosition::set( data.m_slipPos = slipPosition; data.m_slipModeState = m_slipModeState; data.m_loopEnabled = loopEnabled; + data.m_loopInAdjustActive = loopInAdjustActive; + data.m_loopOutAdjustActive = loopOutAdjustActive; data.m_loopStartPos = loopStartPosition; data.m_loopEndPos = loopEndPosition; data.m_tempoTrackSeconds = tempoTrackSeconds; @@ -104,12 +108,14 @@ double VisualPlayPosition::determinePlayPosInLoopBoundries( if (loopSize > 0) { if ((data.m_playRate < 0.0) && (interpolatedPlayPos < data.m_loopStartPos) && - (data.m_playPos >= data.m_loopStartPos)) { + (data.m_playPos >= data.m_loopStartPos) && + !data.m_loopInAdjustActive) { // 1. Deck playing reverse // 2. Interpolated playposition at the time of next VSync would // be outsite of the active loop // 3. Playposition is currently inside the active loop // (not scratching left of an activated loop) + // 4. LoopIn is not hold down interpolatedPlayPos = data.m_loopEndPos - std::remainder( data.m_loopStartPos - interpolatedPlayPos, @@ -117,12 +123,14 @@ double VisualPlayPosition::determinePlayPosInLoopBoundries( } if ((data.m_playRate > 0.0) && (interpolatedPlayPos > data.m_loopEndPos) && - (data.m_playPos <= data.m_loopEndPos)) { + (data.m_playPos <= data.m_loopEndPos) && + !data.m_loopOutAdjustActive) { // 1. Deck playing forward // 2. Interpolated playposition at the time of next VSync would // be outsite of the active loop // 3. Playposition is currently inside the active loop // (not scratching right of an activated loop) + // 4. LoopOut is not hold down interpolatedPlayPos = data.m_loopStartPos + std::remainder( interpolatedPlayPos - data.m_loopEndPos, diff --git a/src/waveform/visualplayposition.h b/src/waveform/visualplayposition.h index 13390f663f4..7fcfd8a5b69 100644 --- a/src/waveform/visualplayposition.h +++ b/src/waveform/visualplayposition.h @@ -40,6 +40,8 @@ class VisualPlayPositionData { double m_slipRate; SlipModeState m_slipModeState; bool m_loopEnabled; + bool m_loopInAdjustActive; + bool m_loopOutAdjustActive; double m_loopStartPos; double m_loopEndPos; double m_tempoTrackSeconds; // total track time, taking the current tempo into account @@ -62,6 +64,8 @@ class VisualPlayPosition : public QObject { double slipRate, SlipModeState slipModeState, bool loopEnabled, + bool loopInAdjustActive, + bool loopOutAdjustActive, double loopStartPos, double loopEndPos, double tempoTrackSeconds, From 083066dcf5c3972b6df057f498cbe67f30b10a20 Mon Sep 17 00:00:00 2001 From: Joerg Date: Wed, 10 Jan 2024 20:09:01 +0100 Subject: [PATCH 2/2] Fixed incorrect English tense in comments --- src/waveform/visualplayposition.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/waveform/visualplayposition.cpp b/src/waveform/visualplayposition.cpp index 54c919641de..847b4cb5873 100644 --- a/src/waveform/visualplayposition.cpp +++ b/src/waveform/visualplayposition.cpp @@ -115,7 +115,7 @@ double VisualPlayPosition::determinePlayPosInLoopBoundries( // be outsite of the active loop // 3. Playposition is currently inside the active loop // (not scratching left of an activated loop) - // 4. LoopIn is not hold down + // 4. LoopIn is not being held down interpolatedPlayPos = data.m_loopEndPos - std::remainder( data.m_loopStartPos - interpolatedPlayPos, @@ -130,7 +130,7 @@ double VisualPlayPosition::determinePlayPosInLoopBoundries( // be outsite of the active loop // 3. Playposition is currently inside the active loop // (not scratching right of an activated loop) - // 4. LoopOut is not hold down + // 4. LoopOut is not being held down interpolatedPlayPos = data.m_loopStartPos + std::remainder( interpolatedPlayPos - data.m_loopEndPos,