Audacity 3.2.0
|
Interface to libsoxr. More...
#include <Resample.h>
Public Member Functions | |
Resample (const bool useBestMethod, const double dMinFactor, const double dMaxFactor) | |
~Resample () | |
Resample (Resample &&) noexcept=default | |
Resample & | operator= (Resample &&) noexcept=default |
Resample (const Resample &)=delete | |
Resample & | operator= (const Resample &)=delete |
std::pair< size_t, size_t > | Process (double factor, const float *inBuffer, size_t inBufferLen, bool lastFlag, float *outBuffer, size_t outBufferLen) |
Main processing function. Resamples from the input buffer to the output buffer. More... | |
Static Public Attributes | |
static EnumSetting< int > | FastMethodSetting |
static EnumSetting< int > | BestMethodSetting |
Protected Member Functions | |
void | SetMethod (const bool useBestMethod) |
Protected Attributes | |
int | mMethod |
soxrHandle | mHandle |
bool | mbWantConstRateResampling |
Interface to libsoxr.
This class abstracts the interface to different resampling libraries:
libsoxr, written by Rob Sykes. LGPL.
Since Audacity always does resampling on mono streams that are contiguous in memory, this class doesn't support multiple channels or some of the other optional features of some of these resamplers.
Definition at line 26 of file Resample.h.
Resample::Resample | ( | const bool | useBestMethod, |
const double | dMinFactor, | ||
const double | dMaxFactor | ||
) |
Resamplers may have more than one method, offering a tradeoff between speed and quality. Audacity identifies two methods out of all of the choices: a Fast method intended for real-time audio I/O, and a Best method intended for mixing and exporting. The first parameter lets you select either the best method or the fast method.
Definition at line 32 of file Resample.cpp.
References mbWantConstRateResampling, mHandle, mMethod, and SetMethod().
Resample::~Resample | ( | ) |
Definition at line 49 of file Resample.cpp.
|
defaultnoexcept |
|
delete |
std::pair< size_t, size_t > Resample::Process | ( | double | factor, |
const float * | inBuffer, | ||
size_t | inBufferLen, | ||
bool | lastFlag, | ||
float * | outBuffer, | ||
size_t | outBufferLen | ||
) |
Main processing function. Resamples from the input buffer to the output buffer.
Reads samples from the input buffer, and writes samples to the output buffer. Stops when either is exhausted, or we reach a convenient block end, unless lastFlag is set to force emptying the input buffer. The number of input samples used is returned in inBufferUsed, and the number of output samples generated is the return value of the function. This function may do nothing if you don't pass a large enough output buffer (i.e. there is no where to put a full block of output data)
factor | The scaling factor to resample by. |
inBuffer | Buffer of input samples to be processed (mono) |
inBufferLen | Length of the input buffer, in samples. |
lastFlag | Flag to indicate this is the last lot of input samples and the buffer needs to be emptied out into the rate converter. (unless lastFlag is true, we don't guarantee to process all the samples in the input this time, we may leave some for next time) |
outBuffer | Buffer to write output (converted) samples to. |
outBufferLen | How big outBuffer is. |
Definition at line 88 of file Resample.cpp.
References mbWantConstRateResampling, and mHandle.
Referenced by ChangeSpeedBase::ProcessOne().
|
protected |
Definition at line 114 of file Resample.cpp.
References BestMethodSetting, FastMethodSetting, mMethod, and EnumSetting< Enum >::ReadEnum().
Referenced by Resample().
|
static |
Definition at line 49 of file Resample.h.
Referenced by QualityPrefs::PopulateOrExchange(), and SetMethod().
|
static |
Definition at line 48 of file Resample.h.
Referenced by QualityPrefs::PopulateOrExchange(), and SetMethod().
|
protected |
Definition at line 87 of file Resample.h.
Referenced by Process(), and Resample().
|
protected |
Definition at line 86 of file Resample.h.
Referenced by Process(), and Resample().
|
protected |
Definition at line 85 of file Resample.h.
Referenced by Resample(), and SetMethod().