Loading...
Searching...
No Matches
Public Member Functions | List of all members
switchboard::Resampler Class Reference

Resamples audio data from one sample rate to another. More...

#include <Resampler.hpp>

Public Member Functions

 Resampler ()
 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 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.
 

Detailed Description

Resamples audio data from one sample rate to another.

Resampler class.

Member Function Documentation

◆ process() [1/4]

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.

Parameters
inputThe float input buffer that needs to be resampled. Either interleaved stereo or mono.
outputThe resampled output buffer. Interleaved stereo. Should not be the same as output.
inputSampleRateThe sample rate of the input buffer.
outputSampleRateThe target sample rate of the output buffer.
Returns
The number of frames in the resampled output buffer.

◆ process() [2/4]

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.

Parameters
inputThe short input buffer that needs to be resampled. Either interleaved stereo or mono.
outputThe resampled output buffer. Interleaved stereo. Should not be the same as output.
inputSampleRateThe sample rate of the input buffer.
outputSampleRateThe target sample rate of the output buffer.
Returns
The number of frames in the resampled output buffer.

◆ process() [3/4]

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.

Parameters
inputThe float input buffer that needs to be resampled. Either interleaved stereo or mono.
outputThe resampled output buffer. Interleaved stereo. Should not be the same as output.
inputSampleRateThe sample rate of the input buffer.
outputSampleRateThe target sample rate of the output buffer.
numberOfInputFramesNumber of frames in the input.
maxNumberOfOutputFramesMax number of frames in the output. Derived from the sample rate ratio.
numChannelsIndicates the number of channels.
endOfInputOptional - Signals the end of input in a stream of input buffers. Resampler needs to be reset after it is set to true.
Returns
The number of frames in the resampled output buffer.

◆ process() [4/4]

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.

Parameters
inputThe short input buffer that needs to be resampled. Either interleaved stereo or mono.
outputThe resampled output buffer. Interleaved stereo. Should not be the same as output.
inputSampleRateThe sample rate of the input buffer.
outputSampleRateThe target sample rate of the output buffer.
numberOfInputFramesNumber of frames in the input.
maxNumberOfOutputFramesMax number of frames in the output. Derived from the sample rate ratio.
numChannelsIndicates the number of channels.
endOfInputOptional - Signals the end of input in a stream of input buffers. Resampler needs to be reset after it is set to true.
Returns
The number of frames in the resampled output buffer.

The documentation for this class was generated from the following files: