1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
5 An audio time-stretching and pitch-shifting library.
6 Copyright 2007-2008 Chris Cannam.
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2 of the
11 License, or (at your option) any later version. See the file
12 COPYING included with this distribution for more information.
15 #include "StretcherImpl.h"
17 namespace RubberBand
{
20 RubberBandStretcher::RubberBandStretcher(size_t sampleRate
,
23 double initialTimeRatio
,
24 double initialPitchScale
) :
25 m_d(new Impl(sampleRate
, channels
, options
,
26 initialTimeRatio
, initialPitchScale
))
30 RubberBandStretcher::~RubberBandStretcher()
36 RubberBandStretcher::reset()
42 RubberBandStretcher::setTimeRatio(double ratio
)
44 m_d
->setTimeRatio(ratio
);
48 RubberBandStretcher::setPitchScale(double scale
)
50 m_d
->setPitchScale(scale
);
54 RubberBandStretcher::getTimeRatio() const
56 return m_d
->getTimeRatio();
60 RubberBandStretcher::getPitchScale() const
62 return m_d
->getPitchScale();
66 RubberBandStretcher::getLatency() const
68 return m_d
->getLatency();
72 RubberBandStretcher::setTransientsOption(Options options
)
74 m_d
->setTransientsOption(options
);
78 RubberBandStretcher::setPhaseOption(Options options
)
80 m_d
->setPhaseOption(options
);
84 RubberBandStretcher::setFormantOption(Options options
)
86 m_d
->setFormantOption(options
);
90 RubberBandStretcher::setPitchOption(Options options
)
92 m_d
->setPitchOption(options
);
96 RubberBandStretcher::setExpectedInputDuration(size_t samples
)
98 m_d
->setExpectedInputDuration(samples
);
102 RubberBandStretcher::setMaxProcessSize(size_t samples
)
104 m_d
->setMaxProcessSize(samples
);
108 RubberBandStretcher::getSamplesRequired() const
110 return m_d
->getSamplesRequired();
114 RubberBandStretcher::study(const float *const *input
, size_t samples
,
117 m_d
->study(input
, samples
, final
);
121 RubberBandStretcher::process(const float *const *input
, size_t samples
,
124 m_d
->process(input
, samples
, final
);
128 RubberBandStretcher::available() const
130 return m_d
->available();
134 RubberBandStretcher::retrieve(float *const *output
, size_t samples
) const
136 return m_d
->retrieve(output
, samples
);
140 RubberBandStretcher::getFrequencyCutoff(int n
) const
142 return m_d
->getFrequencyCutoff(n
);
146 RubberBandStretcher::setFrequencyCutoff(int n
, float f
)
148 m_d
->setFrequencyCutoff(n
, f
);
152 RubberBandStretcher::getInputIncrement() const
154 return m_d
->getInputIncrement();
158 RubberBandStretcher::getOutputIncrements() const
160 return m_d
->getOutputIncrements();
164 RubberBandStretcher::getPhaseResetCurve() const
166 return m_d
->getPhaseResetCurve();
170 RubberBandStretcher::getExactTimePoints() const
172 return m_d
->getExactTimePoints();
176 RubberBandStretcher::getChannelCount() const
178 return m_d
->getChannelCount();
182 RubberBandStretcher::calculateStretch()
184 m_d
->calculateStretch();
188 RubberBandStretcher::setDebugLevel(int level
)
190 m_d
->setDebugLevel(level
);
194 RubberBandStretcher::setDefaultDebugLevel(int level
)
196 Impl::setDefaultDebugLevel(level
);