Switchboard SDK
|
Resamples audio data from one sample rate to another. More...
#include <Resampler.hpp>
Public Member Functions | |
Resampler (const uint maxNumberOfChannels=constants::STEREO, const uint maxNumberOfFrames=constants::MAX_NUMBER_OF_FRAMES) | |
Creates a Resampler instance. | |
~Resampler () | |
Resampler destructor. | |
uint | process (const AudioBuffer< int16 > &input, AudioBuffer< int16 > &output, const uint inputSampleRate, const uint outputSampleRate) |
Resamples an input buffer of sampling rate N, to an output buffer of sampling rate M. | |
uint | process (const AudioBuffer< float > &input, AudioBuffer< float > &output, const uint inputSampleRate, const uint outputSampleRate) |
Resamples an input buffer of sampling rate N, to an output buffer of sampling rate M. | |
uint | process (const int16 *input, float *output, uint inputSampleRate, uint outputSampleRate, uint numberOfInputFrames, uint maxNumberOfOutputFrames, uint numChannels, bool endOfInput=false) |
Resamples an input buffer of sampling rate N, to an output buffer of sampling rate M. | |
uint | process (const float *input, float *output, uint inputSampleRate, uint outputSampleRate, uint numberOfInputFrames, uint maxNumberOfOutputFrames, uint numChannels, bool endOfInput=false) |
Resamples an input buffer of sampling rate N, to an output buffer of sampling rate M. | |
void | process (const float *input, float *output, uint inputSampleRate, uint outputSampleRate, uint numberOfInputFrames, uint maxNumberOfOutputFrames, uint numChannels, bool endOfInput, uint &numberOfInputFramesUsed, uint &numberOfOutputFramesGenerated) |
Resamples an input buffer of sampling rate N, to an output buffer of sampling rate M. | |
void | reset () |
Resets the resampler after endOfInput is set to true in the process method. Needs to be called before a new stream of data is input to the process method. | |
int | getNumberOfBufferedFrames () const |
Retrieves the number of buffered frames currently in the Resampler. | |
Resamples audio data from one sample rate to another.
Resampler class.
switchboard::Resampler::Resampler | ( | const uint | maxNumberOfChannels = constants::STEREO, |
const uint | maxNumberOfFrames = constants::MAX_NUMBER_OF_FRAMES ) |
Creates a Resampler instance.
maxNumberOfChannels | Maximum number of channels that is supported by the resampler, determines buffer sizes. |
maxNumberOfFrames | Maximum number of frames that is supported by the resampler, determines buffer sizes. |
int switchboard::Resampler::getNumberOfBufferedFrames | ( | ) | const |
Retrieves the number of buffered frames currently in the Resampler.
The count returned by this method is indicative of the internal state of the Resampler's buffering system and can be used for diagnostics or managing the flow of data through the Resampler.
uint switchboard::Resampler::process | ( | const AudioBuffer< float > & | input, |
AudioBuffer< float > & | output, | ||
const uint | inputSampleRate, | ||
const uint | outputSampleRate ) |
Resamples an input buffer of sampling rate N, to an output buffer of sampling rate M.
input | The float input buffer that needs to be resampled. Either interleaved stereo or mono. |
output | The resampled output buffer. Interleaved stereo. Should not be the same as output. |
inputSampleRate | The sample rate of the input buffer. |
outputSampleRate | The target sample rate of the output buffer. |
uint switchboard::Resampler::process | ( | const AudioBuffer< int16 > & | input, |
AudioBuffer< int16 > & | output, | ||
const uint | inputSampleRate, | ||
const uint | outputSampleRate ) |
Resamples an input buffer of sampling rate N, to an output buffer of sampling rate M.
input | The short input buffer that needs to be resampled. Either interleaved stereo or mono. |
output | The resampled output buffer. Interleaved stereo. Should not be the same as output. |
inputSampleRate | The sample rate of the input buffer. |
outputSampleRate | The target sample rate of the output buffer. |
void switchboard::Resampler::process | ( | const float * | input, |
float * | output, | ||
uint | inputSampleRate, | ||
uint | outputSampleRate, | ||
uint | numberOfInputFrames, | ||
uint | maxNumberOfOutputFrames, | ||
uint | numChannels, | ||
bool | endOfInput, | ||
uint & | numberOfInputFramesUsed, | ||
uint & | numberOfOutputFramesGenerated ) |
Resamples an input buffer of sampling rate N, to an output buffer of sampling rate M.
input | The float input buffer that needs to be resampled. Either interleaved stereo or mono. |
output | The resampled output buffer. Interleaved stereo. Should not be the same as output. |
inputSampleRate | The sample rate of the input buffer. |
outputSampleRate | The target sample rate of the output buffer. |
numberOfInputFrames | Number of frames in the input. |
maxNumberOfOutputFrames | Max number of frames in the output. Derived from the sample rate ratio. |
numChannels | Indicates the number of channels. |
endOfInput | Optional - Signals the end of input in a stream of input buffers. Resampler needs to be reset after it is set to true. |
numberOfInputFramesUsed | The number of frames used from the input buffer to generate the output. |
numberOfOutputFramesGenerated | The number of frames written to the output buffer. |
uint switchboard::Resampler::process | ( | const float * | input, |
float * | output, | ||
uint | inputSampleRate, | ||
uint | outputSampleRate, | ||
uint | numberOfInputFrames, | ||
uint | maxNumberOfOutputFrames, | ||
uint | numChannels, | ||
bool | endOfInput = false ) |
Resamples an input buffer of sampling rate N, to an output buffer of sampling rate M.
input | The float input buffer that needs to be resampled. Either interleaved stereo or mono. |
output | The resampled output buffer. Interleaved stereo. Should not be the same as output. |
inputSampleRate | The sample rate of the input buffer. |
outputSampleRate | The target sample rate of the output buffer. |
numberOfInputFrames | Number of frames in the input. |
maxNumberOfOutputFrames | Max number of frames in the output. Derived from the sample rate ratio. |
numChannels | Indicates the number of channels. |
endOfInput | Optional - Signals the end of input in a stream of input buffers. Resampler needs to be reset after it is set to true. |
uint switchboard::Resampler::process | ( | const int16 * | input, |
float * | output, | ||
uint | inputSampleRate, | ||
uint | outputSampleRate, | ||
uint | numberOfInputFrames, | ||
uint | maxNumberOfOutputFrames, | ||
uint | numChannels, | ||
bool | endOfInput = false ) |
Resamples an input buffer of sampling rate N, to an output buffer of sampling rate M.
input | The short input buffer that needs to be resampled. Either interleaved stereo or mono. |
output | The resampled output buffer. Interleaved stereo. Should not be the same as output. |
inputSampleRate | The sample rate of the input buffer. |
outputSampleRate | The target sample rate of the output buffer. |
numberOfInputFrames | Number of frames in the input. |
maxNumberOfOutputFrames | Max number of frames in the output. Derived from the sample rate ratio. |
numChannels | Indicates the number of channels. |
endOfInput | Optional - Signals the end of input in a stream of input buffers. Resampler needs to be reset after it is set to true. |