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

Converts audio data stored in arrays between different audio formats. More...

#include <AudioDataConverter.hpp>

Static Public Member Functions

static void floatToShortInt (const float *inputBuffer, int16 *outputBuffer, const uint numberOfFrames)
 Converts float buffer to int16 buffer.
 
static void shortIntToFloat (const int16 *inputBuffer, float *outputBuffer, const uint numberOfFrames)
 Converts int16 buffer to float buffer.
 
template<typename T >
static void interleave (const T **inputBuffers, T *outputBuffer, const uint numberOfChannels, const uint numberOfFrames)
 Interleaves audio data from input buffers into output buffer.
 
template<typename T >
static void deinterleave (const T *inputBuffer, T **outputBuffers, const uint numberOfChannels, const uint numberOfFrames)
 Deinterleaves audio data from input buffer into output buffers.
 
template<typename T >
static void multichannelToMono (const T **inputBuffers, T *outputBuffer, const uint numberOfChannels, const uint numberOfFrames, const bool normalize)
 Mixes down multiple buffers into mono buffer accounting for headroom.
 
template<typename T >
static void multichannelToMonoInterleaved (const T *inputBuffer, T *outputBuffer, const uint numberOfChannels, const uint numberOfFrames, const bool normalize)
 Mixes down interleaved buffer into mono buffer accounting for headroom.
 
static void floatToInt (const float *inputBuffer, int *outputBuffer, size_t numberOfSamples)
 Convert a float buffer to a signed 32-bit integer buffer.
 
static void intToFloat (const int *inputBuffer, float *outputBuffer, size_t numberOfSamples)
 Convert a signed 32-bit integer buffer to a float buffer.
 

Detailed Description

Converts audio data stored in arrays between different audio formats.

AudioDataConverter class.

Member Function Documentation

◆ deinterleave()

template<typename T >
template void switchboard::AudioDataConverter::deinterleave< float > ( const T *  inputBuffer,
T **  outputBuffers,
const uint  numberOfChannels,
const uint  numberOfFrames 
)
static

Deinterleaves audio data from input buffer into output buffers.

Parameters
inputBufferThe interleaved input audio array.
outputBuffersOutput audio data arrays where the deinterleaved data will be stored.
numberOfChannelsThe number of channels to deinterleave.
numberOfFramesThe number of frames in the input buffers.

◆ floatToInt()

void switchboard::AudioDataConverter::floatToInt ( const float *  inputBuffer,
int *  outputBuffer,
size_t  numberOfSamples 
)
static

Convert a float buffer to a signed 32-bit integer buffer.

Parameters
inputBufferInput float buffer.
outputBufferOutput signed 32-bit integer buffer.
numberOfSamplesNumber of samples in the buffers.

◆ floatToShortInt()

void switchboard::AudioDataConverter::floatToShortInt ( const float *  inputBuffer,
int16 *  outputBuffer,
const uint  numberOfFrames 
)
static

Converts float buffer to int16 buffer.

Input and output buffers must be the same length.

Parameters
inputBufferThe float buffer that needs to be converted.
outputBufferThe int16 buffer that will store the converted data.
numberOfFramesLength of input and output buffers.

◆ interleave()

template<typename T >
template void switchboard::AudioDataConverter::interleave< float > ( const T **  inputBuffers,
T *  outputBuffer,
const uint  numberOfChannels,
const uint  numberOfFrames 
)
static

Interleaves audio data from input buffers into output buffer.

Size of output buffer has to be at least numberOfChannels * numberOfFrames.

Parameters
inputBuffersArray of non-interleaved audio data arrays.
outputBufferOutput audio data array where the interleaved data will be stored.
numberOfChannelsThe number of channels to interleave.
numberOfFramesThe number of frames in the input buffers.

◆ intToFloat()

void switchboard::AudioDataConverter::intToFloat ( const int *  inputBuffer,
float *  outputBuffer,
size_t  numberOfSamples 
)
static

Convert a signed 32-bit integer buffer to a float buffer.

Parameters
inputBufferInput signed 32-bit integer buffer.
outputBufferOutput float buffer.
numberOfSamplesNumber of samples in the buffers.

◆ multichannelToMono()

template<typename T >
template void switchboard::AudioDataConverter::multichannelToMono< float > ( const T **  inputBuffers,
T *  outputBuffer,
const uint  numberOfChannels,
const uint  numberOfFrames,
const bool  normalize 
)
static

Mixes down multiple buffers into mono buffer accounting for headroom.

Parameters
inputBuffersArray of non-interleaved audio data arrays.
outputBufferOutput audio data array where the mixed data will be stored.
numberOfChannelsThe number of channels to mix.
numberOfFramesThe number of frames in the input buffers.
normalizeTrue if the signals have to be normalized to the largest signal after mixing.

◆ multichannelToMonoInterleaved()

template<typename T >
template void switchboard::AudioDataConverter::multichannelToMonoInterleaved< float > ( const T *  inputBuffer,
T *  outputBuffer,
const uint  numberOfChannels,
const uint  numberOfFrames,
const bool  normalize 
)
static

Mixes down interleaved buffer into mono buffer accounting for headroom.

Parameters
inputBufferInterleaved audio data array.
outputBufferOutput audio data array where the mixed data will be stored.
numberOfChannelsThe number of channels to mix.
numberOfFramesThe number of frames in the input buffers.
normalizeTrue if the signals have to be normalized to the largest signal after mixing.

◆ shortIntToFloat()

void switchboard::AudioDataConverter::shortIntToFloat ( const int16 *  inputBuffer,
float *  outputBuffer,
const uint  numberOfFrames 
)
static

Converts int16 buffer to float buffer.

Input and output buffers must be the same length.

Parameters
inputBufferThe int16 buffer that needs to be converted.
outputBufferThe float buffer that will store the converted data.
numberOfFramesLength of input and output buffers.

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