summaryrefslogtreecommitdiffstats
path: root/src/vinylcontrol
diff options
context:
space:
mode:
authorDaniel Schürmann <daschuer@mixxx.org>2018-07-25 23:11:48 +0200
committerDaniel Schürmann <daschuer@mixxx.org>2018-09-14 23:50:09 +0200
commit657bf7a37b09b1945d9c681cd7cf1c02afe29a27 (patch)
tree9329ad1442a1a5a96d9dcfa5a2ef8448617a621a /src/vinylcontrol
parent6bb06b736ef1be7204732c81c551e1dc6e31ec88 (diff)
Switch all code to the new rate_ratio control
Diffstat (limited to 'src/vinylcontrol')
-rw-r--r--src/vinylcontrol/vinylcontrol.cpp3
-rw-r--r--src/vinylcontrol/vinylcontrol.h8
-rw-r--r--src/vinylcontrol/vinylcontrolxwax.cpp32
-rw-r--r--src/vinylcontrol/vinylcontrolxwax.h1
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 3aa0e9cf96..f080e09340 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;