diff options
author | Daniel Schürmann <daschuer@mixxx.org> | 2016-02-17 21:29:36 +0100 |
---|---|---|
committer | Daniel Schürmann <daschuer@mixxx.org> | 2016-02-17 21:29:36 +0100 |
commit | 4287657424fba6618a11075e806b8d6fed475efe (patch) | |
tree | 0ad14b58258298a96701deaa95a5a743dba96927 /src/vinylcontrol/vinylcontrolxwax.cpp | |
parent | f4331379e15a8864ed4cb903d17737d7f0f20b21 (diff) |
use calcRateRatio in VinylControlXwax as well
Diffstat (limited to 'src/vinylcontrol/vinylcontrolxwax.cpp')
-rw-r--r-- | src/vinylcontrol/vinylcontrolxwax.cpp | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/src/vinylcontrol/vinylcontrolxwax.cpp b/src/vinylcontrol/vinylcontrolxwax.cpp index c668503604..4efacb2da9 100644 --- a/src/vinylcontrol/vinylcontrolxwax.cpp +++ b/src/vinylcontrol/vinylcontrolxwax.cpp @@ -440,19 +440,18 @@ void VinylControlXwax::analyzeSamples(CSAMPLE* pSamples, size_t nFrames) { } if (m_iVCMode == MIXXX_VCMODE_CONSTANT) { - //when we enabled constant mode we set the rate slider - //now we just either set scratch val to 0 (stops playback) - //or 1 (plays back at that rate) + // when we enabled constant mode we set the rate slider + // now we just either set scratch val to 0 (stops playback) + // or 1 (plays back at that rate) - double newScratch = reportedPlayButton ? rateDir->get() * - (m_pRateSlider->get() * rateRange->get()) + 1.0 : 0.0; + double newScratch = reportedPlayButton ? calcRateRatio() : 0.0; m_pVCRate->set(newScratch); - //is there any reason we'd need to do anything else? + // is there any reason we'd need to do anything else? return; } - //CONSTANT MODE NO LONGER APPLIES... + // CONSTANT MODE NO LONGER APPLIES... // When there's a timecode signal available // This is set when we analyze samples (no need for lock I think) @@ -497,7 +496,7 @@ void VinylControlXwax::analyzeSamples(CSAMPLE* pSamples, size_t nFrames) { syncPosition(); resetSteadyPitch(dVinylPitch, m_dVinylPosition); if (uiUpdateTime(filePosition)) { - m_pRateSlider->set(rateDir->get() * (fabs(dVinylPitch) - 1.0) / rateRange->get()); + m_pRateSlider->set(m_pRateDir->get() * (fabs(dVinylPitch) - 1.0) / m_pRateRange->get()); } } else if (m_iVCMode == MIXXX_VCMODE_ABSOLUTE && (fabs(m_dVinylPosition - m_dVinylPositionOld) >= 5.0)) { @@ -616,8 +615,8 @@ 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(rateDir->get() * - (m_dDisplayPitch - 1.0) / rateRange->get()); + m_pRateSlider->set(m_pRateDir->get() * + (m_dDisplayPitch - 1.0) / m_pRateRange->get()); } else { m_pRateSlider->set(0.0); } @@ -674,7 +673,7 @@ void VinylControlXwax::enableConstantMode() { mode->slotSet((double)m_iVCMode); togglePlayButton(true); double rate = m_pVCRate->get(); - m_pRateSlider->set(rateDir->get() * (fabs(rate) - 1.0) / rateRange->get()); + m_pRateSlider->set(m_pRateDir->get() * (fabs(rate) - 1.0) / m_pRateRange->get()); m_pVCRate->set(rate); } @@ -683,7 +682,7 @@ void VinylControlXwax::enableConstantMode(double rate) { m_iVCMode = MIXXX_VCMODE_CONSTANT; mode->slotSet((double)m_iVCMode); togglePlayButton(true); - m_pRateSlider->set(rateDir->get() * (fabs(rate) - 1.0) / rateRange->get()); + m_pRateSlider->set(m_pRateDir->get() * (fabs(rate) - 1.0) / m_pRateRange->get()); m_pVCRate->set(rate); } @@ -787,7 +786,7 @@ bool VinylControlXwax::checkEnabled(bool was, bool is) { //This allows for single-deck control, dj handoffs, etc. togglePlayButton(playButton->get() || fabs(m_pVCRate->get()) > 0.05); - m_pVCRate->set(rateDir->get() * (m_pRateSlider->get() * rateRange->get()) + 1.0); + m_pVCRate->set(calcRateRatio()); resetSteadyPitch(0.0, 0.0); m_bForceResync = true; if (!was) @@ -841,3 +840,10 @@ 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; +} + |