Skip to content

Commit

Permalink
Merge pull request #12281 from JoergAtGithub/playposfix
Browse files Browse the repository at this point in the history
Fix for visual waveform position while scratching outside of an activated loop
  • Loading branch information
daschuer authored Nov 17, 2023
2 parents a89f676 + 4afe03d commit c3a8fd8
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/waveform/visualplayposition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,27 @@ double VisualPlayPosition::determinePlayPosInLoopBoundries(
if (data.m_loopEnabled) {
double loopSize = data.m_loopEndPos - data.m_loopStartPos;
if (loopSize > 0) {
if ((data.m_playRate < 0.0) && (interpolatedPlayPos < data.m_loopStartPos)) {
if ((data.m_playRate < 0.0) &&
(interpolatedPlayPos < data.m_loopStartPos) &&
(data.m_playPos >= data.m_loopStartPos)) {
// 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)
interpolatedPlayPos = data.m_loopEndPos -
std::remainder(
data.m_loopStartPos - interpolatedPlayPos,
loopSize);
}
if ((data.m_playRate > 0.0) && (interpolatedPlayPos > data.m_loopEndPos)) {
if ((data.m_playRate > 0.0) &&
(interpolatedPlayPos > data.m_loopEndPos) &&
(data.m_playPos <= data.m_loopEndPos)) {
// 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)
interpolatedPlayPos = data.m_loopStartPos +
std::remainder(
interpolatedPlayPos - data.m_loopEndPos,
Expand Down

0 comments on commit c3a8fd8

Please sign in to comment.