Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slip mode: consider loop for background position only if it was enabled before slip #11848

Merged
merged 1 commit into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions src/engine/controls/loopingcontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ LoopingControl::LoopingControl(const QString& group,
: EngineControl(group, pConfig),
m_bLoopingEnabled(false),
m_bLoopRollActive(false),
m_bLoopWasEnabledBeforeSlipEnable(false),
m_bAdjustingLoopIn(false),
m_bAdjustingLoopOut(false),
m_bAdjustingLoopInOld(false),
Expand Down Expand Up @@ -1164,6 +1165,8 @@ void LoopingControl::notifySeek(mixxx::audio::FramePos newPosition) {
}

void LoopingControl::setLoopingEnabled(bool enabled) {
m_bLoopWasEnabledBeforeSlipEnable =
!m_pSlipEnabled->toBool() && enabled && !m_bLoopRollActive;
if (m_bLoopingEnabled == enabled) {
return;
}
Expand All @@ -1182,14 +1185,6 @@ void LoopingControl::setLoopingEnabled(bool enabled) {
emit loopEnabledChanged(enabled);
}

bool LoopingControl::isLoopingEnabled() {
return m_bLoopingEnabled;
}

bool LoopingControl::isLoopRollActive() {
return m_bLoopRollActive;
}

void LoopingControl::trackLoaded(TrackPointer pNewTrack) {
m_pTrack = pNewTrack;
mixxx::BeatsPointer pBeats;
Expand Down
13 changes: 11 additions & 2 deletions src/engine/controls/loopingcontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,16 @@ class LoopingControl : public EngineControl {
mixxx::audio::FramePos endPosition,
bool enabled);
void setRateControl(RateControl* rateControl);
bool isLoopingEnabled();
bool isLoopRollActive();

bool isLoopingEnabled() {
return m_bLoopingEnabled;
}
bool isLoopRollActive() {
return m_bLoopRollActive;
}
bool loopWasEnabledBeforeSlipEnable() {
return m_bLoopWasEnabledBeforeSlipEnable;
}

void trackLoaded(TrackPointer pNewTrack) override;
void trackBeatsUpdated(mixxx::BeatsPointer pBeats) override;
Expand Down Expand Up @@ -175,6 +183,7 @@ class LoopingControl : public EngineControl {

bool m_bLoopingEnabled;
bool m_bLoopRollActive;
bool m_bLoopWasEnabledBeforeSlipEnable;
bool m_bAdjustingLoopIn;
bool m_bAdjustingLoopOut;
bool m_bAdjustingLoopInOld;
Expand Down
1 change: 1 addition & 0 deletions src/engine/enginebuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1213,6 +1213,7 @@ void EngineBuffer::processSlip(int iBufferSize) {
static_cast<mixxx::audio::FrameDiff_t>(bufferFrameCount) * m_dSlipRate;
// Simulate looping if a regular loop is active
if (m_pLoopingControl->isLoopingEnabled() &&
m_pLoopingControl->loopWasEnabledBeforeSlipEnable() &&
!m_pLoopingControl->isLoopRollActive()) {
const mixxx::audio::FramePos newPos = m_slipPosition + slipDelta;
m_slipPosition = m_pLoopingControl->adjustedPositionForCurrentLoop(
Expand Down
Loading