Skip to content
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
7 changes: 7 additions & 0 deletions src/engine/controls/ratecontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -628,3 +628,10 @@ void RateControl::notifyWrapAround(mixxx::audio::FramePos triggerPos,
void RateControl::notifySeek(mixxx::audio::FramePos position) {
m_pScratchController->notifySeek(position);
}

void RateControl::resetPositionScratchController() {
// Resets the scratch state to avoid engine freeze due to insanley high rate
// reported on track load while scratching.
// https://github.com/mixxxdj/mixxx/issues/15082
m_pScratchController->reset();
}
1 change: 1 addition & 0 deletions src/engine/controls/ratecontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class RateControl : public EngineControl {
void notifyWrapAround(mixxx::audio::FramePos triggerPos,
mixxx::audio::FramePos targetPos);
void notifySeek(mixxx::audio::FramePos position) override;
void resetPositionScratchController();

public slots:
void slotRateRangeChanged(double);
Expand Down
6 changes: 6 additions & 0 deletions src/engine/enginebuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -627,13 +627,19 @@ void EngineBuffer::ejectTrack() {

if (pOldTrack) {
notifyTrackLoaded(TrackPointer(), pOldTrack);
} else {
// When not invoking notifyTrackLoaded() call this separately
m_pRateControl->resetPositionScratchController();
}

m_iTrackLoading = 0;
m_pChannelToCloneFrom = nullptr;
}

void EngineBuffer::notifyTrackLoaded(
TrackPointer pNewTrack, TrackPointer pOldTrack) {
m_pRateControl->resetPositionScratchController();

if (pOldTrack) {
disconnect(
pOldTrack.get(),
Expand Down
10 changes: 10 additions & 0 deletions src/engine/positionscratchcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,3 +329,13 @@ void PositionScratchController::notifySeek(mixxx::audio::FramePos position) {
// distance traveled in m_samplePosDeltaSum
m_seekSamplePos = newPos;
}

void PositionScratchController::reset() {
// Resets the scratch state to avoid engine freeze due to insanley high rate
// reported on track load while scratching.
// https://github.com/mixxxdj/mixxx/issues/15082
m_pScratchEnable->set(0.0);
m_isScratching = false;
m_inertiaEnabled = false;
m_rate = 0;
}
1 change: 1 addition & 0 deletions src/engine/positionscratchcontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class PositionScratchController : public QObject {
return m_rate;
}
void notifySeek(mixxx::audio::FramePos position);
void reset();

private slots:
void slotUpdateFilterParameters(double sampleRate);
Expand Down