From 06521f00437c6ff7ddb879bc91d7cc5511f73307 Mon Sep 17 00:00:00 2001 From: Chris Cannam Date: Thu, 16 Jun 2022 15:58:59 +0100 Subject: [PATCH 1/2] Avoid reusing variable name! --- main/main.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/main/main.cpp b/main/main.cpp index 031474b..d49e63c 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -84,8 +84,6 @@ double tempo_convert(const char *str) int main(int argc, char **argv) { - int c; - double ratio = 1.0; double duration = 0.0; double pitchshift = 0.0; @@ -182,12 +180,12 @@ int main(int argc, char **argv) { 0, 0, 0, 0 } }; - c = getopt_long(argc, argv, - "t:p:d:RLPFc:f:T:D:qhHVM:23", - longOpts, &optionIndex); - if (c == -1) break; + int optionChar = getopt_long(argc, argv, + "t:p:d:RLPFc:f:T:D:qhHVM:23", + longOpts, &optionIndex); + if (optionChar == -1) break; - switch (c) { + switch (optionChar) { case 'h': help = true; break; case 'H': fullHelp = true; break; case 'V': version = true; break; From ea148cb3ca02692f98520ee8e601f12010cf4225 Mon Sep 17 00:00:00 2001 From: Chris Cannam Date: Fri, 17 Jun 2022 08:26:05 +0100 Subject: [PATCH 2/2] More rt entry points --- src/RubberBandStretcher.cpp | 20 +++++++++++++++++--- src/finer/R3StretcherImpl.cpp | 3 --- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/RubberBandStretcher.cpp b/src/RubberBandStretcher.cpp index 8e62e33..f850d89 100644 --- a/src/RubberBandStretcher.cpp +++ b/src/RubberBandStretcher.cpp @@ -24,11 +24,8 @@ #include "faster/StretcherImpl.h" #include "finer/R3StretcherImpl.h" - namespace RubberBand { -//#define FASTER 1 - RubberBandStretcher::RubberBandStretcher(size_t sampleRate, size_t channels, Options options, @@ -61,6 +58,7 @@ RubberBandStretcher::reset() else m_r3d->reset(); } +RTENTRY__ void RubberBandStretcher::setTimeRatio(double ratio) { @@ -68,6 +66,7 @@ RubberBandStretcher::setTimeRatio(double ratio) else m_r3d->setTimeRatio(ratio); } +RTENTRY__ void RubberBandStretcher::setPitchScale(double scale) { @@ -75,12 +74,14 @@ RubberBandStretcher::setPitchScale(double scale) else m_r3d->setPitchScale(scale); } +RTENTRY__ void RubberBandStretcher::setFormantScale(double scale) { if (m_r3d) m_r3d->setFormantScale(scale); } +RTENTRY__ double RubberBandStretcher::getTimeRatio() const { @@ -88,6 +89,7 @@ RubberBandStretcher::getTimeRatio() const else return m_r3d->getTimeRatio(); } +RTENTRY__ double RubberBandStretcher::getPitchScale() const { @@ -95,6 +97,7 @@ RubberBandStretcher::getPitchScale() const else return m_r3d->getPitchScale(); } +RTENTRY__ double RubberBandStretcher::getFormantScale() const { @@ -102,6 +105,7 @@ RubberBandStretcher::getFormantScale() const else return m_r3d->getFormantScale(); } +RTENTRY__ size_t RubberBandStretcher::getLatency() const { @@ -111,24 +115,28 @@ RubberBandStretcher::getLatency() const //!!! review all these +RTENTRY__ void RubberBandStretcher::setTransientsOption(Options options) { if (m_d) m_d->setTransientsOption(options); } +RTENTRY__ void RubberBandStretcher::setDetectorOption(Options options) { if (m_d) m_d->setDetectorOption(options); } +RTENTRY__ void RubberBandStretcher::setPhaseOption(Options options) { if (m_d) m_d->setPhaseOption(options); } +RTENTRY__ void RubberBandStretcher::setFormantOption(Options options) { @@ -136,6 +144,7 @@ RubberBandStretcher::setFormantOption(Options options) else if (m_r3d) m_r3d->setFormantOption(options); } +RTENTRY__ void RubberBandStretcher::setPitchOption(Options options) { @@ -161,6 +170,7 @@ RubberBandStretcher::setKeyFrameMap(const std::map &mapping) else m_r3d->setKeyFrameMap(mapping); } +RTENTRY__ size_t RubberBandStretcher::getSamplesRequired() const { @@ -176,6 +186,7 @@ RubberBandStretcher::study(const float *const *input, size_t samples, else m_r3d->study(input, samples, final); } +RTENTRY__ void RubberBandStretcher::process(const float *const *input, size_t samples, bool final) @@ -184,6 +195,7 @@ RubberBandStretcher::process(const float *const *input, size_t samples, else m_r3d->process(input, samples, final); } +RTENTRY__ int RubberBandStretcher::available() const { @@ -191,6 +203,7 @@ RubberBandStretcher::available() const else return m_r3d->available(); } +RTENTRY__ size_t RubberBandStretcher::retrieve(float *const *output, size_t samples) const { @@ -239,6 +252,7 @@ RubberBandStretcher::getExactTimePoints() const else return {}; } +RTENTRY__ size_t RubberBandStretcher::getChannelCount() const { diff --git a/src/finer/R3StretcherImpl.cpp b/src/finer/R3StretcherImpl.cpp index e471372..e9dbf88 100644 --- a/src/finer/R3StretcherImpl.cpp +++ b/src/finer/R3StretcherImpl.cpp @@ -384,7 +384,6 @@ R3StretcherImpl::getSamplesRequired() const } } -RTENTRY__ void R3StretcherImpl::process(const float *const *input, size_t samples, bool final) { @@ -430,7 +429,6 @@ R3StretcherImpl::process(const float *const *input, size_t samples, bool final) consume(); } -RTENTRY__ int R3StretcherImpl::available() const { @@ -442,7 +440,6 @@ R3StretcherImpl::available() const } } -RTENTRY__ size_t R3StretcherImpl::retrieve(float *const *output, size_t samples) const {