diff options
author | Daniel Schürmann <daschuer@mixxx.org> | 2018-12-14 20:31:56 +0100 |
---|---|---|
committer | Daniel Schürmann <daschuer@mixxx.org> | 2018-12-14 20:31:56 +0100 |
commit | c6e727910e05e87efe2afadae81743ff777cca11 (patch) | |
tree | 152c2f052e430df431beedecd581586c4fbdeed3 /src/vinylcontrol | |
parent | 85a5a6c41a33c8493361158c598c7ea873230422 (diff) | |
parent | 9cab17a5d1bf88649e35e92aeb4c9df5857630d3 (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')
-rw-r--r-- | src/vinylcontrol/vinylcontrol.cpp | 3 | ||||
-rw-r--r-- | src/vinylcontrol/vinylcontrol.h | 8 | ||||
-rw-r--r-- | src/vinylcontrol/vinylcontrolxwax.cpp | 32 | ||||
-rw-r--r-- | src/vinylcontrol/vinylcontrolxwax.h | 1 |
4 files changed, 13 insertions, 31 deletions
diff --git a/src/vinylcontrol/vinylcontrol.cpp b/src/vinylcontrol/vinylcontrol.cpp index 7ee315b2eb..878bfab54f 100644 --- a/src/vinylcontrol/vinylcontrol.cpp +++ b/src/vinylcontrol/vinylcontrol.cpp @@ -24,7 +24,6 @@ VinylControl::VinylControl(UserSettingsPointer pConfig, QString group) vinylSeek = new ControlProxy(group, "vinylcontrol_seek", this); m_pVCRate = new ControlProxy(group, "vinylcontrol_rate", this); m_pRateRatio = new ControlProxy(group, "rate_ratio", this); - m_pRateSlider = new ControlProxy(group, "rate", this); playButton = new ControlProxy(group, "play", this); duration = new ControlProxy(group, "duration", this); mode = new ControlProxy(group, "vinylcontrol_mode", this); @@ -33,9 +32,7 @@ VinylControl::VinylControl(UserSettingsPointer pConfig, QString group) group, "vinylcontrol_wantenabled", this); cueing = new ControlProxy(group, "vinylcontrol_cueing", this); scratching = new ControlProxy(group, "vinylcontrol_scratching", this); - m_pRateRange = new ControlProxy(group, "rateRange", this); vinylStatus = new ControlProxy(group, "vinylcontrol_status", this); - m_pRateDir = new ControlProxy(group, "rate_dir", this); loopEnabled = new ControlProxy(group, "loop_enabled", this); signalenabled = new ControlProxy( group, "vinylcontrol_signal_enabled", this); diff --git a/src/vinylcontrol/vinylcontrol.h b/src/vinylcontrol/vinylcontrol.h index 8506bf69d8..5cd1370c23 100644 --- a/src/vinylcontrol/vinylcontrol.h +++ b/src/vinylcontrol/vinylcontrol.h @@ -43,10 +43,6 @@ class VinylControl : public QObject { // VC and and is used to change the speed/pitch of the song without VC // 1.0 = original rate ControlProxy* m_pRateRatio; - // Reflects the mean value (filtered for display) used of m_pVCRate during - // VC and and is used to change the speed/pitch of the song without VC - // 0.0 = original rate - ControlProxy* m_pRateSlider; // The ControlObject used to get the duration of the current song. ControlProxy* duration; // The ControlObject used to get the vinyl control mode @@ -62,11 +58,7 @@ class VinylControl : public QObject { ControlProxy* cueing; // Is pitch changing very quickly? ControlProxy* scratching; - // The ControlObject used to the get the pitch range from the prefs. - ControlProxy* m_pRateRange; ControlProxy* vinylStatus; - // direction of rate - ControlProxy* m_pRateDir; // looping enabled? ControlProxy* loopEnabled; // show the signal in the skin? 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; -} diff --git a/src/vinylcontrol/vinylcontrolxwax.h b/src/vinylcontrol/vinylcontrolxwax.h index 861627f1b8..f0b3be6907 100644 --- a/src/vinylcontrol/vinylcontrolxwax.h +++ b/src/vinylcontrol/vinylcontrolxwax.h @@ -46,7 +46,6 @@ class VinylControlXwax : public VinylControl { void enableConstantMode(double rate); bool uiUpdateTime(double time); void establishQuality(bool quality_sample); - double calcRateRatio() const; // Cache the position of the end of record unsigned int m_uiSafeZone; |