summaryrefslogtreecommitdiffstats
path: root/src/vinylcontrol/vinylcontrolxwax.cpp
diff options
context:
space:
mode:
authorDaniel Schürmann <daschuer@mixxx.org>2018-12-14 20:31:56 +0100
committerDaniel Schürmann <daschuer@mixxx.org>2018-12-14 20:31:56 +0100
commitc6e727910e05e87efe2afadae81743ff777cca11 (patch)
tree152c2f052e430df431beedecd581586c4fbdeed3 /src/vinylcontrol/vinylcontrolxwax.cpp
parent85a5a6c41a33c8493361158c598c7ea873230422 (diff)
parent9cab17a5d1bf88649e35e92aeb4c9df5857630d3 (diff)
Merge commit '9cab17a5d1bf88649e35e92aeb4c9df5857630d3' into rate_ratio
Conflicts: src/engine/bpmcontrol.cpp src/engine/keycontrol.cpp src/engine/keycontrol.h src/engine/ratecontrol.cpp
Diffstat (limited to 'src/vinylcontrol/vinylcontrolxwax.cpp')
-rw-r--r--src/vinylcontrol/vinylcontrolxwax.cpp32
1 files changed, 13 insertions, 19 deletions
diff --git a/src/vinylcontrol/vinylcontrolxwax.cpp b/src/vinylcontrol/vinylcontrolxwax.cpp
index 0904f64dc8..11728b5b84 100644
--- a/src/vinylcontrol/vinylcontrolxwax.cpp
+++ b/src/vinylcontrol/vinylcontrolxwax.cpp
@@ -444,7 +444,7 @@ void VinylControlXwax::analyzeSamples(CSAMPLE* pSamples, size_t nFrames) {
// now we just either set scratch val to 0 (stops playback)
// or 1 (plays back at that rate)
- double newScratch = reportedPlayButton ? calcRateRatio() : 0.0;
+ double newScratch = reportedPlayButton ? m_pRateRatio->get() : 0.0;
m_pVCRate->set(newScratch);
// is there any reason we'd need to do anything else?
@@ -496,7 +496,7 @@ void VinylControlXwax::analyzeSamples(CSAMPLE* pSamples, size_t nFrames) {
syncPosition();
resetSteadyPitch(dVinylPitch, m_dVinylPosition);
if (uiUpdateTime(filePosition)) {
- m_pRateSlider->set(m_pRateDir->get() * (fabs(dVinylPitch) - 1.0) / m_pRateRange->get());
+ m_pRateRatio->set(fabs(dVinylPitch));
}
} else if (m_iVCMode == MIXXX_VCMODE_ABSOLUTE &&
(fabs(m_dVinylPosition - m_dVinylPositionOld) >= 5.0)) {
@@ -614,11 +614,10 @@ void VinylControlXwax::analyzeSamples(CSAMPLE* pSamples, size_t nFrames) {
}
// Don't show extremely high or low speeds in the UI.
if (reportedPlayButton && !scratching->get() &&
- m_dDisplayPitch < 1.9 && m_dDisplayPitch > 0.2) {
- m_pRateSlider->set(m_pRateDir->get() *
- (m_dDisplayPitch - 1.0) / m_pRateRange->get());
+ m_dDisplayPitch < 1.9 && m_dDisplayPitch > 0.2) {
+ m_pRateRatio->set(m_dDisplayPitch);
} else {
- m_pRateSlider->set(0.0);
+ m_pRateRatio->set(1.0);
}
m_dUiUpdateTime = filePosition;
}
@@ -633,7 +632,7 @@ void VinylControlXwax::analyzeSamples(CSAMPLE* pSamples, size_t nFrames) {
//if it hasn't been long,
//let the track play a wee bit more before deciding we've stopped
- m_pRateSlider->set(0.0);
+ m_pRateRatio->set(0.0);
if (m_iVCMode == MIXXX_VCMODE_ABSOLUTE &&
fabs(m_dVinylPosition - filePosition) >= 0.1) {
@@ -780,17 +779,18 @@ bool VinylControlXwax::checkEnabled(bool was, bool is) {
}
if (was != is) {
- //we reset the scratch value, but we don't reset the rate slider.
- //This means if we are playing, and we disable vinyl control,
- //the track will keep playing at the previous rate.
- //This allows for single-deck control, dj handoffs, etc.
+ // we reset the scratch value, but we don't reset the rate slider.
+ // This means if we are playing, and we disable vinyl control,
+ // the track will keep playing at the previous rate.
+ // This allows for single-deck control, dj handoffs, etc.
togglePlayButton(playButton->get() || fabs(m_pVCRate->get()) > 0.05);
- m_pVCRate->set(calcRateRatio());
+ m_pVCRate->set(m_pRateRatio->get());
resetSteadyPitch(0.0, 0.0);
m_bForceResync = true;
- if (!was)
+ if (!was) {
m_dOldFilePos = 0.0;
+ }
m_iVCMode = mode->get();
m_bAtRecordEnd = false;
}
@@ -840,9 +840,3 @@ float VinylControlXwax::getAngle() {
// Invert angle to make vinyl spin direction correct.
return 360 - (static_cast<int>(pos / 1000.0 * 360.0 * rps) % 360);
}
-
-double VinylControlXwax::calcRateRatio() const {
- double rateRatio = 1.0 + m_pRateDir->get() * m_pRateRange->get() *
- m_pRateSlider->get();
- return rateRatio;
-}