2007-11-06 21:41:16 +00:00
|
|
|
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
|
|
|
|
|
|
|
|
|
/*
|
2012-09-09 16:57:42 +01:00
|
|
|
Rubber Band Library
|
2007-11-06 21:41:16 +00:00
|
|
|
An audio time-stretching and pitch-shifting library.
|
2023-01-10 11:10:06 +00:00
|
|
|
Copyright 2007-2023 Particular Programs Ltd.
|
2012-09-09 16:57:42 +01:00
|
|
|
|
2007-11-06 21:41:16 +00:00
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
|
modify it under the terms of the GNU General Public License as
|
|
|
|
|
published by the Free Software Foundation; either version 2 of the
|
|
|
|
|
License, or (at your option) any later version. See the file
|
|
|
|
|
COPYING included with this distribution for more information.
|
2012-09-09 16:57:42 +01:00
|
|
|
|
|
|
|
|
Alternatively, if you have a valid commercial licence for the
|
|
|
|
|
Rubber Band Library obtained by agreement with the copyright
|
|
|
|
|
holders, you may redistribute and/or modify it under the terms
|
|
|
|
|
described in that licence.
|
|
|
|
|
|
|
|
|
|
If you wish to distribute code using the Rubber Band Library
|
|
|
|
|
under terms other than those of the GNU General Public License,
|
|
|
|
|
you must obtain a valid commercial licence before doing so.
|
2007-11-06 21:41:16 +00:00
|
|
|
*/
|
|
|
|
|
|
2022-06-21 10:25:08 +01:00
|
|
|
#include "faster/R2Stretcher.h"
|
|
|
|
|
#include "finer/R3Stretcher.h"
|
2007-11-06 21:41:16 +00:00
|
|
|
|
2022-06-23 09:52:23 +01:00
|
|
|
#include <iostream>
|
|
|
|
|
|
2008-07-01 10:25:17 +00:00
|
|
|
namespace RubberBand {
|
2007-11-06 21:41:16 +00:00
|
|
|
|
2022-06-21 10:25:08 +01:00
|
|
|
class RubberBandStretcher::Impl
|
|
|
|
|
{
|
|
|
|
|
R2Stretcher *m_r2;
|
|
|
|
|
R3Stretcher *m_r3;
|
2022-06-21 16:06:16 +01:00
|
|
|
|
2022-06-23 09:52:23 +01:00
|
|
|
class CerrLogger : public RubberBandStretcher::Logger {
|
|
|
|
|
public:
|
|
|
|
|
void log(const char *message) override {
|
|
|
|
|
std::cerr << "RubberBand: " << message << "\n";
|
|
|
|
|
}
|
|
|
|
|
void log(const char *message, double arg0) override {
|
|
|
|
|
auto prec = std::cerr.precision();
|
|
|
|
|
std::cerr.precision(10);
|
|
|
|
|
std::cerr << "RubberBand: " << message << ": " << arg0 << "\n";
|
|
|
|
|
std::cerr.precision(prec);
|
|
|
|
|
}
|
|
|
|
|
void log(const char *message, double arg0, double arg1) override {
|
|
|
|
|
auto prec = std::cerr.precision();
|
|
|
|
|
std::cerr.precision(10);
|
|
|
|
|
std::cerr << "RubberBand: " << message
|
|
|
|
|
<< ": (" << arg0 << ", " << arg1 << ")" << "\n";
|
|
|
|
|
std::cerr.precision(prec);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2022-06-21 16:06:16 +01:00
|
|
|
Log makeRBLog(std::shared_ptr<RubberBandStretcher::Logger> logger) {
|
|
|
|
|
if (logger) {
|
|
|
|
|
return Log(
|
|
|
|
|
[=](const char *message) {
|
2022-06-22 09:10:02 +01:00
|
|
|
logger->log(message);
|
2022-06-21 16:06:16 +01:00
|
|
|
},
|
|
|
|
|
[=](const char *message, double arg0) {
|
2022-06-22 09:10:02 +01:00
|
|
|
logger->log(message, arg0);
|
2022-06-21 16:06:16 +01:00
|
|
|
},
|
|
|
|
|
[=](const char *message, double arg0, double arg1) {
|
2022-06-22 09:10:02 +01:00
|
|
|
logger->log(message, arg0, arg1);
|
2022-06-21 16:06:16 +01:00
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
} else {
|
2022-06-23 09:52:23 +01:00
|
|
|
return makeRBLog(std::shared_ptr<RubberBandStretcher::Logger>
|
|
|
|
|
(new CerrLogger()));
|
2022-06-21 16:06:16 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-21 10:25:08 +01:00
|
|
|
public:
|
|
|
|
|
Impl(size_t sampleRate, size_t channels, Options options,
|
2022-06-21 16:06:16 +01:00
|
|
|
std::shared_ptr<RubberBandStretcher::Logger> logger,
|
2022-06-21 10:25:08 +01:00
|
|
|
double initialTimeRatio, double initialPitchScale) :
|
|
|
|
|
m_r2 (!(options & OptionEngineFiner) ?
|
|
|
|
|
new R2Stretcher(sampleRate, channels, options,
|
2022-06-21 16:06:16 +01:00
|
|
|
initialTimeRatio, initialPitchScale,
|
|
|
|
|
makeRBLog(logger))
|
2022-06-21 10:25:08 +01:00
|
|
|
: nullptr),
|
|
|
|
|
m_r3 ((options & OptionEngineFiner) ?
|
|
|
|
|
new R3Stretcher(R3Stretcher::Parameters
|
|
|
|
|
(double(sampleRate), channels, options),
|
2022-06-21 16:06:16 +01:00
|
|
|
initialTimeRatio, initialPitchScale,
|
|
|
|
|
makeRBLog(logger))
|
2022-06-21 10:25:08 +01:00
|
|
|
: nullptr)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
~Impl()
|
|
|
|
|
{
|
|
|
|
|
delete m_r2;
|
|
|
|
|
delete m_r3;
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-28 11:47:30 +01:00
|
|
|
int getEngineVersion() const
|
|
|
|
|
{
|
|
|
|
|
if (m_r3) return 3;
|
|
|
|
|
else return 2;
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-21 10:25:08 +01:00
|
|
|
void reset()
|
|
|
|
|
{
|
|
|
|
|
if (m_r2) m_r2->reset();
|
|
|
|
|
else m_r3->reset();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RTENTRY__
|
|
|
|
|
void
|
|
|
|
|
setTimeRatio(double ratio)
|
|
|
|
|
{
|
|
|
|
|
if (m_r2) m_r2->setTimeRatio(ratio);
|
|
|
|
|
else m_r3->setTimeRatio(ratio);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RTENTRY__
|
|
|
|
|
void
|
|
|
|
|
setPitchScale(double scale)
|
|
|
|
|
{
|
|
|
|
|
if (m_r2) m_r2->setPitchScale(scale);
|
|
|
|
|
else m_r3->setPitchScale(scale);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RTENTRY__
|
|
|
|
|
void
|
|
|
|
|
setFormantScale(double scale)
|
|
|
|
|
{
|
|
|
|
|
//!!!
|
|
|
|
|
if (m_r3) m_r3->setFormantScale(scale);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RTENTRY__
|
|
|
|
|
double
|
|
|
|
|
getTimeRatio() const
|
|
|
|
|
{
|
|
|
|
|
if (m_r2) return m_r2->getTimeRatio();
|
|
|
|
|
else return m_r3->getTimeRatio();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RTENTRY__
|
|
|
|
|
double
|
|
|
|
|
getPitchScale() const
|
|
|
|
|
{
|
|
|
|
|
if (m_r2) return m_r2->getPitchScale();
|
|
|
|
|
else return m_r3->getPitchScale();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RTENTRY__
|
|
|
|
|
double
|
|
|
|
|
getFormantScale() const
|
|
|
|
|
{
|
|
|
|
|
//!!!
|
|
|
|
|
if (m_r2) return 0.0;
|
|
|
|
|
else return m_r3->getFormantScale();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RTENTRY__
|
|
|
|
|
size_t
|
2022-07-05 17:53:36 +01:00
|
|
|
getPreferredStartPad() const
|
2022-06-21 10:25:08 +01:00
|
|
|
{
|
2022-07-05 17:53:36 +01:00
|
|
|
if (m_r2) return m_r2->getPreferredStartPad();
|
|
|
|
|
else return m_r3->getPreferredStartPad();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RTENTRY__
|
|
|
|
|
size_t
|
|
|
|
|
getStartDelay() const
|
|
|
|
|
{
|
|
|
|
|
if (m_r2) return m_r2->getStartDelay();
|
|
|
|
|
else return m_r3->getStartDelay();
|
2022-06-21 10:25:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//!!! review all these
|
|
|
|
|
|
|
|
|
|
RTENTRY__
|
|
|
|
|
void
|
|
|
|
|
setTransientsOption(Options options)
|
|
|
|
|
{
|
|
|
|
|
if (m_r2) m_r2->setTransientsOption(options);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RTENTRY__
|
|
|
|
|
void
|
|
|
|
|
setDetectorOption(Options options)
|
|
|
|
|
{
|
|
|
|
|
if (m_r2) m_r2->setDetectorOption(options);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RTENTRY__
|
|
|
|
|
void
|
|
|
|
|
setPhaseOption(Options options)
|
|
|
|
|
{
|
|
|
|
|
if (m_r2) m_r2->setPhaseOption(options);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RTENTRY__
|
|
|
|
|
void
|
|
|
|
|
setFormantOption(Options options)
|
|
|
|
|
{
|
|
|
|
|
if (m_r2) m_r2->setFormantOption(options);
|
|
|
|
|
else if (m_r3) m_r3->setFormantOption(options);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RTENTRY__
|
|
|
|
|
void
|
|
|
|
|
setPitchOption(Options options)
|
|
|
|
|
{
|
|
|
|
|
if (m_r2) m_r2->setPitchOption(options);
|
2022-07-06 10:22:50 +01:00
|
|
|
else if (m_r3) m_r3->setPitchOption(options);
|
2022-06-21 10:25:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
setExpectedInputDuration(size_t samples)
|
|
|
|
|
{
|
|
|
|
|
if (m_r2) m_r2->setExpectedInputDuration(samples);
|
2022-07-07 10:54:23 +01:00
|
|
|
else m_r3->setExpectedInputDuration(samples);
|
2022-06-21 10:25:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
setMaxProcessSize(size_t samples)
|
|
|
|
|
{
|
2022-06-24 14:01:11 +01:00
|
|
|
if (m_r2) m_r2->setMaxProcessSize(samples);
|
|
|
|
|
else m_r3->setMaxProcessSize(samples);
|
2022-06-21 10:25:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
setKeyFrameMap(const std::map<size_t, size_t> &mapping)
|
|
|
|
|
{
|
|
|
|
|
if (m_r2) m_r2->setKeyFrameMap(mapping);
|
|
|
|
|
else m_r3->setKeyFrameMap(mapping);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RTENTRY__
|
|
|
|
|
size_t
|
|
|
|
|
getSamplesRequired() const
|
|
|
|
|
{
|
|
|
|
|
if (m_r2) return m_r2->getSamplesRequired();
|
|
|
|
|
else return m_r3->getSamplesRequired();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
study(const float *const *input, size_t samples,
|
|
|
|
|
bool final)
|
|
|
|
|
{
|
|
|
|
|
if (m_r2) m_r2->study(input, samples, final);
|
|
|
|
|
else m_r3->study(input, samples, final);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RTENTRY__
|
|
|
|
|
void
|
|
|
|
|
process(const float *const *input, size_t samples,
|
|
|
|
|
bool final)
|
|
|
|
|
{
|
|
|
|
|
if (m_r2) m_r2->process(input, samples, final);
|
|
|
|
|
else m_r3->process(input, samples, final);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RTENTRY__
|
|
|
|
|
int
|
|
|
|
|
available() const
|
|
|
|
|
{
|
|
|
|
|
if (m_r2) return m_r2->available();
|
|
|
|
|
else return m_r3->available();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RTENTRY__
|
|
|
|
|
size_t
|
|
|
|
|
retrieve(float *const *output, size_t samples) const
|
|
|
|
|
{
|
|
|
|
|
if (m_r2) return m_r2->retrieve(output, samples);
|
|
|
|
|
else return m_r3->retrieve(output, samples);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float
|
|
|
|
|
getFrequencyCutoff(int n) const
|
|
|
|
|
{
|
|
|
|
|
if (m_r2) return m_r2->getFrequencyCutoff(n);
|
|
|
|
|
else return {};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
setFrequencyCutoff(int n, float f)
|
|
|
|
|
{
|
|
|
|
|
if (m_r2) m_r2->setFrequencyCutoff(n, f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
size_t
|
|
|
|
|
getInputIncrement() const
|
|
|
|
|
{
|
|
|
|
|
if (m_r2) return m_r2->getInputIncrement();
|
|
|
|
|
else return {};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::vector<int>
|
|
|
|
|
getOutputIncrements() const
|
|
|
|
|
{
|
|
|
|
|
if (m_r2) return m_r2->getOutputIncrements();
|
|
|
|
|
else return {};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::vector<float>
|
|
|
|
|
getPhaseResetCurve() const
|
|
|
|
|
{
|
|
|
|
|
if (m_r2) return m_r2->getPhaseResetCurve();
|
|
|
|
|
else return {};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::vector<int>
|
|
|
|
|
getExactTimePoints() const
|
|
|
|
|
{
|
|
|
|
|
if (m_r2) return m_r2->getExactTimePoints();
|
|
|
|
|
else return {};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RTENTRY__
|
|
|
|
|
size_t
|
|
|
|
|
getChannelCount() const
|
|
|
|
|
{
|
|
|
|
|
if (m_r2) return m_r2->getChannelCount();
|
|
|
|
|
else return m_r3->getChannelCount();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
calculateStretch()
|
|
|
|
|
{
|
|
|
|
|
if (m_r2) m_r2->calculateStretch();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
setDebugLevel(int level)
|
|
|
|
|
{
|
|
|
|
|
if (m_r2) m_r2->setDebugLevel(level);
|
2022-06-21 16:06:16 +01:00
|
|
|
else m_r3->setDebugLevel(level);
|
2022-06-21 10:25:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
setDefaultDebugLevel(int level)
|
|
|
|
|
{
|
2022-06-21 16:06:16 +01:00
|
|
|
Log::setDefaultDebugLevel(level);
|
2022-06-21 10:25:08 +01:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2008-07-01 10:25:17 +00:00
|
|
|
RubberBandStretcher::RubberBandStretcher(size_t sampleRate,
|
|
|
|
|
size_t channels,
|
|
|
|
|
Options options,
|
|
|
|
|
double initialTimeRatio,
|
|
|
|
|
double initialPitchScale) :
|
2022-06-21 16:06:16 +01:00
|
|
|
m_d(new Impl(sampleRate, channels, options, nullptr,
|
|
|
|
|
initialTimeRatio, initialPitchScale))
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RubberBandStretcher::RubberBandStretcher(size_t sampleRate,
|
|
|
|
|
size_t channels,
|
|
|
|
|
std::shared_ptr<Logger> logger,
|
|
|
|
|
Options options,
|
|
|
|
|
double initialTimeRatio,
|
|
|
|
|
double initialPitchScale) :
|
|
|
|
|
m_d(new Impl(sampleRate, channels, options, logger,
|
2022-06-21 10:25:08 +01:00
|
|
|
initialTimeRatio, initialPitchScale))
|
2008-07-01 10:25:17 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RubberBandStretcher::~RubberBandStretcher()
|
|
|
|
|
{
|
|
|
|
|
delete m_d;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
RubberBandStretcher::reset()
|
|
|
|
|
{
|
2022-06-21 10:25:08 +01:00
|
|
|
m_d->reset();
|
2008-07-01 10:25:17 +00:00
|
|
|
}
|
|
|
|
|
|
2022-06-28 11:47:30 +01:00
|
|
|
int
|
|
|
|
|
RubberBandStretcher::getEngineVersion() const
|
|
|
|
|
{
|
|
|
|
|
return m_d->getEngineVersion();
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-17 08:26:05 +01:00
|
|
|
RTENTRY__
|
2008-07-01 10:25:17 +00:00
|
|
|
void
|
|
|
|
|
RubberBandStretcher::setTimeRatio(double ratio)
|
2007-11-06 21:41:16 +00:00
|
|
|
{
|
2022-06-21 10:25:08 +01:00
|
|
|
m_d->setTimeRatio(ratio);
|
2008-07-01 10:25:17 +00:00
|
|
|
}
|
|
|
|
|
|
2022-06-17 08:26:05 +01:00
|
|
|
RTENTRY__
|
2008-07-01 10:25:17 +00:00
|
|
|
void
|
|
|
|
|
RubberBandStretcher::setPitchScale(double scale)
|
|
|
|
|
{
|
2022-06-21 10:25:08 +01:00
|
|
|
m_d->setPitchScale(scale);
|
2008-07-01 10:25:17 +00:00
|
|
|
}
|
|
|
|
|
|
2022-06-17 08:26:05 +01:00
|
|
|
RTENTRY__
|
2022-06-13 10:39:13 +01:00
|
|
|
void
|
|
|
|
|
RubberBandStretcher::setFormantScale(double scale)
|
|
|
|
|
{
|
2022-06-21 10:25:08 +01:00
|
|
|
m_d->setFormantScale(scale);
|
2022-06-13 10:39:13 +01:00
|
|
|
}
|
|
|
|
|
|
2022-06-17 08:26:05 +01:00
|
|
|
RTENTRY__
|
2008-07-01 10:25:17 +00:00
|
|
|
double
|
|
|
|
|
RubberBandStretcher::getTimeRatio() const
|
|
|
|
|
{
|
2022-06-21 10:25:08 +01:00
|
|
|
return m_d->getTimeRatio();
|
2008-07-01 10:25:17 +00:00
|
|
|
}
|
2007-11-06 21:41:16 +00:00
|
|
|
|
2022-06-17 08:26:05 +01:00
|
|
|
RTENTRY__
|
2008-07-01 10:25:17 +00:00
|
|
|
double
|
|
|
|
|
RubberBandStretcher::getPitchScale() const
|
2007-11-06 21:41:16 +00:00
|
|
|
{
|
2022-06-21 10:25:08 +01:00
|
|
|
return m_d->getPitchScale();
|
2007-11-06 21:41:16 +00:00
|
|
|
}
|
|
|
|
|
|
2022-06-17 08:26:05 +01:00
|
|
|
RTENTRY__
|
2022-06-13 10:39:13 +01:00
|
|
|
double
|
|
|
|
|
RubberBandStretcher::getFormantScale() const
|
|
|
|
|
{
|
2022-06-21 10:25:08 +01:00
|
|
|
return m_d->getFormantScale();
|
2022-06-13 10:39:13 +01:00
|
|
|
}
|
|
|
|
|
|
2022-07-05 17:53:36 +01:00
|
|
|
RTENTRY__
|
|
|
|
|
size_t
|
|
|
|
|
RubberBandStretcher::getPreferredStartPad() const
|
|
|
|
|
{
|
|
|
|
|
return m_d->getPreferredStartPad();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RTENTRY__
|
|
|
|
|
size_t
|
|
|
|
|
RubberBandStretcher::getStartDelay() const
|
|
|
|
|
{
|
|
|
|
|
return m_d->getStartDelay();
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-17 08:26:05 +01:00
|
|
|
RTENTRY__
|
2008-07-01 10:25:17 +00:00
|
|
|
size_t
|
|
|
|
|
RubberBandStretcher::getLatency() const
|
2007-11-06 21:41:16 +00:00
|
|
|
{
|
2022-07-05 17:53:36 +01:00
|
|
|
// deprecated alias for getStartDelay
|
|
|
|
|
return m_d->getStartDelay();
|
2007-11-06 21:41:16 +00:00
|
|
|
}
|
|
|
|
|
|
2022-06-17 08:26:05 +01:00
|
|
|
RTENTRY__
|
2008-07-01 10:25:17 +00:00
|
|
|
void
|
|
|
|
|
RubberBandStretcher::setTransientsOption(Options options)
|
2007-11-06 21:41:16 +00:00
|
|
|
{
|
2022-06-21 10:25:08 +01:00
|
|
|
m_d->setTransientsOption(options);
|
2007-11-06 21:41:16 +00:00
|
|
|
}
|
|
|
|
|
|
2022-06-17 08:26:05 +01:00
|
|
|
RTENTRY__
|
2010-03-24 09:44:51 +00:00
|
|
|
void
|
|
|
|
|
RubberBandStretcher::setDetectorOption(Options options)
|
|
|
|
|
{
|
2022-06-21 10:25:08 +01:00
|
|
|
m_d->setDetectorOption(options);
|
2010-03-24 09:44:51 +00:00
|
|
|
}
|
|
|
|
|
|
2022-06-17 08:26:05 +01:00
|
|
|
RTENTRY__
|
2008-07-01 10:25:17 +00:00
|
|
|
void
|
|
|
|
|
RubberBandStretcher::setPhaseOption(Options options)
|
2007-11-06 21:41:16 +00:00
|
|
|
{
|
2022-06-21 10:25:08 +01:00
|
|
|
m_d->setPhaseOption(options);
|
2007-11-06 21:41:16 +00:00
|
|
|
}
|
|
|
|
|
|
2022-06-17 08:26:05 +01:00
|
|
|
RTENTRY__
|
2008-07-01 10:25:17 +00:00
|
|
|
void
|
|
|
|
|
RubberBandStretcher::setFormantOption(Options options)
|
2008-05-22 16:54:27 +00:00
|
|
|
{
|
2022-06-21 10:25:08 +01:00
|
|
|
m_d->setFormantOption(options);
|
2008-05-22 16:54:27 +00:00
|
|
|
}
|
|
|
|
|
|
2022-06-17 08:26:05 +01:00
|
|
|
RTENTRY__
|
2008-07-01 10:25:17 +00:00
|
|
|
void
|
|
|
|
|
RubberBandStretcher::setPitchOption(Options options)
|
2008-05-22 16:54:27 +00:00
|
|
|
{
|
2022-06-21 10:25:08 +01:00
|
|
|
m_d->setPitchOption(options);
|
2008-05-22 16:54:27 +00:00
|
|
|
}
|
|
|
|
|
|
2008-07-01 10:25:17 +00:00
|
|
|
void
|
|
|
|
|
RubberBandStretcher::setExpectedInputDuration(size_t samples)
|
2007-11-06 21:41:16 +00:00
|
|
|
{
|
2022-06-21 10:25:08 +01:00
|
|
|
m_d->setExpectedInputDuration(samples);
|
2007-11-06 21:41:16 +00:00
|
|
|
}
|
|
|
|
|
|
2008-07-01 10:25:17 +00:00
|
|
|
void
|
|
|
|
|
RubberBandStretcher::setMaxProcessSize(size_t samples)
|
2007-11-06 21:41:16 +00:00
|
|
|
{
|
2022-06-21 10:25:08 +01:00
|
|
|
m_d->setMaxProcessSize(samples);
|
2007-11-06 21:41:16 +00:00
|
|
|
}
|
|
|
|
|
|
2010-03-24 09:44:51 +00:00
|
|
|
void
|
2021-04-14 19:14:32 +01:00
|
|
|
RubberBandStretcher::setKeyFrameMap(const std::map<size_t, size_t> &mapping)
|
2010-03-24 09:44:51 +00:00
|
|
|
{
|
2022-06-21 10:25:08 +01:00
|
|
|
m_d->setKeyFrameMap(mapping);
|
2010-03-24 09:44:51 +00:00
|
|
|
}
|
|
|
|
|
|
2022-06-17 08:26:05 +01:00
|
|
|
RTENTRY__
|
2008-07-01 10:25:17 +00:00
|
|
|
size_t
|
|
|
|
|
RubberBandStretcher::getSamplesRequired() const
|
2007-11-06 21:41:16 +00:00
|
|
|
{
|
2022-06-21 10:25:08 +01:00
|
|
|
return m_d->getSamplesRequired();
|
2007-11-06 21:41:16 +00:00
|
|
|
}
|
|
|
|
|
|
2008-07-01 10:25:17 +00:00
|
|
|
void
|
|
|
|
|
RubberBandStretcher::study(const float *const *input, size_t samples,
|
|
|
|
|
bool final)
|
2007-11-06 21:41:16 +00:00
|
|
|
{
|
2022-06-21 10:25:08 +01:00
|
|
|
m_d->study(input, samples, final);
|
2007-11-06 21:41:16 +00:00
|
|
|
}
|
|
|
|
|
|
2022-06-17 08:26:05 +01:00
|
|
|
RTENTRY__
|
2008-07-01 10:25:17 +00:00
|
|
|
void
|
|
|
|
|
RubberBandStretcher::process(const float *const *input, size_t samples,
|
|
|
|
|
bool final)
|
2007-11-06 21:41:16 +00:00
|
|
|
{
|
2022-06-21 10:25:08 +01:00
|
|
|
m_d->process(input, samples, final);
|
2007-11-06 21:41:16 +00:00
|
|
|
}
|
|
|
|
|
|
2022-06-17 08:26:05 +01:00
|
|
|
RTENTRY__
|
2008-07-01 10:25:17 +00:00
|
|
|
int
|
|
|
|
|
RubberBandStretcher::available() const
|
2007-11-06 21:41:16 +00:00
|
|
|
{
|
2022-06-21 10:25:08 +01:00
|
|
|
return m_d->available();
|
2007-11-06 21:41:16 +00:00
|
|
|
}
|
|
|
|
|
|
2022-06-17 08:26:05 +01:00
|
|
|
RTENTRY__
|
2008-07-01 10:25:17 +00:00
|
|
|
size_t
|
|
|
|
|
RubberBandStretcher::retrieve(float *const *output, size_t samples) const
|
2007-11-06 21:41:16 +00:00
|
|
|
{
|
2022-06-21 10:25:08 +01:00
|
|
|
return m_d->retrieve(output, samples);
|
2007-11-06 21:41:16 +00:00
|
|
|
}
|
|
|
|
|
|
2008-07-01 10:25:17 +00:00
|
|
|
float
|
|
|
|
|
RubberBandStretcher::getFrequencyCutoff(int n) const
|
2007-11-06 21:41:16 +00:00
|
|
|
{
|
2022-06-21 10:25:08 +01:00
|
|
|
return m_d->getFrequencyCutoff(n);
|
2007-11-06 21:41:16 +00:00
|
|
|
}
|
|
|
|
|
|
2008-07-01 10:25:17 +00:00
|
|
|
void
|
|
|
|
|
RubberBandStretcher::setFrequencyCutoff(int n, float f)
|
2007-11-06 21:41:16 +00:00
|
|
|
{
|
2022-06-21 10:25:08 +01:00
|
|
|
m_d->setFrequencyCutoff(n, f);
|
2007-11-06 21:41:16 +00:00
|
|
|
}
|
|
|
|
|
|
2008-07-01 10:25:17 +00:00
|
|
|
size_t
|
|
|
|
|
RubberBandStretcher::getInputIncrement() const
|
2007-11-06 21:41:16 +00:00
|
|
|
{
|
2022-06-21 10:25:08 +01:00
|
|
|
return m_d->getInputIncrement();
|
2007-11-06 21:41:16 +00:00
|
|
|
}
|
|
|
|
|
|
2021-04-14 19:14:32 +01:00
|
|
|
std::vector<int>
|
2008-07-01 10:25:17 +00:00
|
|
|
RubberBandStretcher::getOutputIncrements() const
|
2007-11-06 21:41:16 +00:00
|
|
|
{
|
2022-06-21 10:25:08 +01:00
|
|
|
return m_d->getOutputIncrements();
|
2007-11-06 21:41:16 +00:00
|
|
|
}
|
|
|
|
|
|
2021-04-14 19:14:32 +01:00
|
|
|
std::vector<float>
|
2008-07-01 10:25:17 +00:00
|
|
|
RubberBandStretcher::getPhaseResetCurve() const
|
2007-11-06 21:41:16 +00:00
|
|
|
{
|
2022-06-21 10:25:08 +01:00
|
|
|
return m_d->getPhaseResetCurve();
|
2007-11-06 21:41:16 +00:00
|
|
|
}
|
|
|
|
|
|
2021-04-14 19:14:32 +01:00
|
|
|
std::vector<int>
|
2008-07-01 10:25:17 +00:00
|
|
|
RubberBandStretcher::getExactTimePoints() const
|
2007-11-07 22:34:30 +00:00
|
|
|
{
|
2022-06-21 10:25:08 +01:00
|
|
|
return m_d->getExactTimePoints();
|
2007-11-07 22:34:30 +00:00
|
|
|
}
|
|
|
|
|
|
2022-06-17 08:26:05 +01:00
|
|
|
RTENTRY__
|
2008-07-01 10:25:17 +00:00
|
|
|
size_t
|
|
|
|
|
RubberBandStretcher::getChannelCount() const
|
2007-11-06 21:41:16 +00:00
|
|
|
{
|
2022-06-21 10:25:08 +01:00
|
|
|
return m_d->getChannelCount();
|
2007-11-06 21:41:16 +00:00
|
|
|
}
|
|
|
|
|
|
2008-07-01 10:25:17 +00:00
|
|
|
void
|
|
|
|
|
RubberBandStretcher::calculateStretch()
|
2007-11-06 21:41:16 +00:00
|
|
|
{
|
2022-06-21 10:25:08 +01:00
|
|
|
m_d->calculateStretch();
|
2007-11-06 21:41:16 +00:00
|
|
|
}
|
|
|
|
|
|
2008-07-01 10:25:17 +00:00
|
|
|
void
|
|
|
|
|
RubberBandStretcher::setDebugLevel(int level)
|
2007-11-06 21:41:16 +00:00
|
|
|
{
|
2022-06-21 10:25:08 +01:00
|
|
|
m_d->setDebugLevel(level);
|
2007-11-06 21:41:16 +00:00
|
|
|
}
|
|
|
|
|
|
2008-07-01 10:25:17 +00:00
|
|
|
void
|
|
|
|
|
RubberBandStretcher::setDefaultDebugLevel(int level)
|
2007-11-20 20:17:13 +00:00
|
|
|
{
|
2008-07-01 10:25:17 +00:00
|
|
|
Impl::setDefaultDebugLevel(level);
|
2007-11-20 20:17:13 +00:00
|
|
|
}
|
2008-07-01 10:25:17 +00:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|