diff --git a/ladspa-lv2/RubberBandLivePitchShifter.cpp b/ladspa-lv2/RubberBandLivePitchShifter.cpp index 16bcaa5..74f3f40 100644 --- a/ladspa-lv2/RubberBandLivePitchShifter.cpp +++ b/ladspa-lv2/RubberBandLivePitchShifter.cpp @@ -266,7 +266,6 @@ RubberBandLivePitchShifter::RubberBandLivePitchShifter(int sampleRate, size_t ch m_currentFormant(false), m_shifter(new RubberBandLiveShifter (sampleRate, channels, - RubberBandLiveShifter::OptionPitchMethodStandard | RubberBandLiveShifter::OptionChannelsTogether)), m_sampleRate(sampleRate), m_channels(channels), diff --git a/rubberband/RubberBandLiveShifter.h b/rubberband/RubberBandLiveShifter.h index a9b37ff..bbf16e9 100644 --- a/rubberband/RubberBandLiveShifter.h +++ b/rubberband/RubberBandLiveShifter.h @@ -102,9 +102,6 @@ public: OptionFormantShifted = 0x00000000, OptionFormantPreserved = 0x01000000, - OptionPitchMethodStandard = 0x00000000, - OptionPitchMethodAlternate = 0x02000000, - OptionChannelsApart = 0x00000000, OptionChannelsTogether = 0x10000000, diff --git a/src/finer/R3LiveShifter.cpp b/src/finer/R3LiveShifter.cpp index 9fbd1ba..0dfb6e6 100644 --- a/src/finer/R3LiveShifter.cpp +++ b/src/finer/R3LiveShifter.cpp @@ -45,7 +45,6 @@ R3LiveShifter::R3LiveShifter(Parameters parameters, Log log) : m_useReadahead(false), m_prevInhop(m_limits.maxInhopWithReadahead / 2), m_prevOuthop(m_prevInhop), - m_expandThenContract(false), m_firstProcess(true), m_unityCount(0) { @@ -71,11 +70,6 @@ R3LiveShifter::initialise() m_useReadahead = true; } - if ((m_parameters.options & RubberBandLiveShifter::OptionPitchMethodAlternate)) { - m_log.log(1, "R3LiveShifter::R3LiveShifter: expand-then-contract enabled"); - m_expandThenContract = true; - } - double maxClassifierFrequency = 16000.0; if (maxClassifierFrequency > m_parameters.sampleRate/2) { maxClassifierFrequency = m_parameters.sampleRate/2; @@ -247,14 +241,8 @@ R3LiveShifter::measureResamplerDelay() auto outbuf = inbuf; double inRatio = 1.0; - if (m_expandThenContract) { - if (m_pitchScale < 1.0) { - inRatio = 1.0 / m_pitchScale; - } - } else { - if (m_pitchScale > 1.0) { - inRatio = 1.0 / m_pitchScale; - } + if (m_pitchScale > 1.0) { + inRatio = 1.0 / m_pitchScale; } int outcount = m_inResampler->resampleInterleaved @@ -290,18 +278,10 @@ R3LiveShifter::getStartDelay() const { int fixed = getWindowSourceSize() / 2 + m_resamplerDelay * 2; int variable = getWindowSourceSize() / 2; - if (m_expandThenContract) { - if (m_pitchScale < 1.0) { - return size_t(fixed + ceil(variable * m_pitchScale)); - } else { - return size_t(fixed + ceil(variable / m_pitchScale)); - } + if (m_pitchScale < 1.0) { + return size_t(fixed + ceil(variable / m_pitchScale)); } else { - if (m_pitchScale < 1.0) { - return size_t(fixed + ceil(variable / m_pitchScale)); - } else { - return size_t(fixed + ceil(variable * m_pitchScale)); - } + return size_t(fixed + ceil(variable * m_pitchScale)); } } @@ -353,13 +333,9 @@ R3LiveShifter::shift(const float *const *input, float *const *output) int pad = 0; if (m_firstProcess) { - if (m_expandThenContract) { - pad = getWindowSourceSize() / 2; - } else { - pad = getWindowSourceSize(); - if (m_pitchScale > 1.0) { - pad = int(ceil(pad * m_pitchScale)); - } + pad = getWindowSourceSize(); + if (m_pitchScale > 1.0) { + pad = int(ceil(pad * m_pitchScale)); } m_log.log(2, "R3LiveShifter::shift: extending input with pre-pad", incount, pad); for (int c = 0; c < m_parameters.channels; ++c) { @@ -371,14 +347,8 @@ R3LiveShifter::shift(const float *const *input, float *const *output) double outRatio = 1.0; - if (m_expandThenContract) { - if (m_pitchScale > 1.0) { - outRatio = 1.0 / m_pitchScale; - } - } else { - if (m_pitchScale < 1.0) { - outRatio = 1.0 / m_pitchScale; - } + if (m_pitchScale < 1.0) { + outRatio = 1.0 / m_pitchScale; } int requiredInOutbuf = int(ceil(incount / outRatio)); @@ -440,15 +410,8 @@ R3LiveShifter::readIn(const float *const *input) } double inRatio = 1.0; - - if (m_expandThenContract) { - if (m_pitchScale < 1.0) { - inRatio = 1.0 / m_pitchScale; - } - } else { - if (m_pitchScale > 1.0) { - inRatio = 1.0 / m_pitchScale; - } + if (m_pitchScale > 1.0) { + inRatio = 1.0 / m_pitchScale; } m_log.log(2, "R3LiveShifter::readIn: ratio", inRatio); @@ -639,15 +602,8 @@ int R3LiveShifter::readOut(float *const *output, int outcount) { double outRatio = 1.0; - - if (m_expandThenContract) { - if (m_pitchScale > 1.0) { - outRatio = 1.0 / m_pitchScale; - } - } else { - if (m_pitchScale < 1.0) { - outRatio = 1.0 / m_pitchScale; - } + if (m_pitchScale < 1.0) { + outRatio = 1.0 / m_pitchScale; } m_log.log(2, "R3LiveShifter::readOut: outcount and ratio", outcount, outRatio); diff --git a/src/finer/R3LiveShifter.h b/src/finer/R3LiveShifter.h index 814ea52..044f245 100644 --- a/src/finer/R3LiveShifter.h +++ b/src/finer/R3LiveShifter.h @@ -315,7 +315,6 @@ protected: bool m_useReadahead; int m_prevInhop; int m_prevOuthop; - bool m_expandThenContract; // otherwise contract then expand bool m_firstProcess; uint32_t m_unityCount; diff --git a/src/test/TestLiveShifter.cpp b/src/test/TestLiveShifter.cpp index 2cbede5..a7bb194 100644 --- a/src/test/TestLiveShifter.cpp +++ b/src/test/TestLiveShifter.cpp @@ -230,34 +230,18 @@ static void check_sinusoid_shifted(int n, int rate, float freq, float shift, } } -BOOST_AUTO_TEST_CASE(sinusoid_unchanged_mode_a) +BOOST_AUTO_TEST_CASE(sinusoid_unchanged) { - RubberBandLiveShifter::Options options = - RubberBandLiveShifter::OptionPitchMethodStandard; int n = 20000; - - check_sinusoid_unchanged(n, 44100, 440.f, options, false); - check_sinusoid_unchanged(n, 48000, 260.f, options, false); + check_sinusoid_unchanged(n, 44100, 440.f, 0, false); + check_sinusoid_unchanged(n, 48000, 260.f, 0, false); } -BOOST_AUTO_TEST_CASE(sinusoid_unchanged_mode_b) +BOOST_AUTO_TEST_CASE(sinusoid_down_octave) { - RubberBandLiveShifter::Options options = - RubberBandLiveShifter::OptionPitchMethodAlternate; int n = 20000; - - check_sinusoid_unchanged(n, 44100, 440.f, options, false); - check_sinusoid_unchanged(n, 48000, 260.f, options, false); -} - -BOOST_AUTO_TEST_CASE(sinusoid_down_octave_mode_a) -{ - RubberBandLiveShifter::Options options = - RubberBandLiveShifter::OptionPitchMethodStandard; - int n = 20000; - - check_sinusoid_shifted(n, 44100, 440.f, 0.5f, options, true); -// check_sinusoid_shifted(n, 48000, 260.f, 0.5f, options, false); + check_sinusoid_shifted(n, 44100, 440.f, 0.5f, 0, true); +// check_sinusoid_shifted(n, 48000, 260.f, 0.5f, 0, false); } BOOST_AUTO_TEST_SUITE_END()