Add faster/finer option

This commit is contained in:
Chris Cannam
2022-05-26 15:07:43 +01:00
parent c3309f56c1
commit b07f74e5b9
2 changed files with 20 additions and 10 deletions

View File

@@ -317,7 +317,10 @@ public:
OptionPitchHighConsistency = 0x04000000,
OptionChannelsApart = 0x00000000,
OptionChannelsTogether = 0x10000000
OptionChannelsTogether = 0x10000000,
OptionEngineFaster = 0x00000000,
OptionEngineFiner = 0x20000000
// n.b. Options is int, so we must stop before 0x80000000
};

View File

@@ -27,21 +27,23 @@
namespace RubberBand {
//#define FASTER 1
RubberBandStretcher::RubberBandStretcher(size_t sampleRate,
size_t channels,
Options options,
double initialTimeRatio,
double initialPitchScale) :
/*!!!
m_d(new Impl(sampleRate, channels, options,
initialTimeRatio, initialPitchScale))
*/
m_d(nullptr),
//!!! +logger
m_r3d(new R3StretcherImpl(R3StretcherImpl::Parameters(sampleRate, channels),
initialTimeRatio,
initialPitchScale))
m_d
(!(options & OptionEngineFiner) ?
new Impl(sampleRate, channels, options,
initialTimeRatio, initialPitchScale)
: nullptr),
m_r3d
((options & OptionEngineFiner) ?
new R3StretcherImpl(R3StretcherImpl::Parameters(sampleRate, channels),
initialTimeRatio, initialPitchScale)
: nullptr)
{
}
@@ -183,6 +185,7 @@ float
RubberBandStretcher::getFrequencyCutoff(int n) const
{
if (m_d) return m_d->getFrequencyCutoff(n);
else return {};
}
void
@@ -195,24 +198,28 @@ size_t
RubberBandStretcher::getInputIncrement() const
{
if (m_d) return m_d->getInputIncrement();
else return {};
}
std::vector<int>
RubberBandStretcher::getOutputIncrements() const
{
if (m_d) return m_d->getOutputIncrements();
else return {};
}
std::vector<float>
RubberBandStretcher::getPhaseResetCurve() const
{
if (m_d) return m_d->getPhaseResetCurve();
else return {};
}
std::vector<int>
RubberBandStretcher::getExactTimePoints() const
{
if (m_d) return m_d->getExactTimePoints();
else return {};
}
size_t