Switchboard SDK
Loading...
Searching...
No Matches
switchboard::IOResampler Class Reference

Provides a callback function that is called with resampled audio data. More...

#include <IOResampler.hpp>

Public Member Functions

 IOResampler (const uint sourceSampleRate, const uint callbackSampleRate, const IOResamplerCallbackFunction callback)
 Creates an IOResampler instance.
 
bool process (float **buffers, const bool inputIsMono, const uint numberOfFrames, void *userPointer)
 Audio process function of IOResampler.
 

Detailed Description

Provides a callback function that is called with resampled audio data.

IOResampler class.

Supports mono and stereo input and stereo output.

The IOResampler contains two resamplers and it works like this:

[Input audio @ source sample rate] - [Resampler] - [Callback function @ callback sample rate] - [Resampler] - [Output audio @ source sample rate]

Number of frames is never changed during the process call. Returned audio data might contain zero values initially.

Constructor & Destructor Documentation

◆ IOResampler()

switchboard::IOResampler::IOResampler ( const uint sourceSampleRate,
const uint callbackSampleRate,
const IOResamplerCallbackFunction callback )

Creates an IOResampler instance.

Parameters
sourceSampleRateThe source sample rate.
callbackSampleRateThe sample rate of the audio data that will be passed to the callback function.
callbackThe callback function that processed the resampled audio data.

Member Function Documentation

◆ process()

bool switchboard::IOResampler::process ( float ** buffers,
const bool inputIsMono,
const uint numberOfFrames,
void * userPointer )

Audio process function of IOResampler.

Parameters
buffers[inout] The buffers containing the audio data.
inputIsMonoMust be true if the buffers parameter contains mono data, false otherwise.
numberOfFramesNumber of frames in the buffers parameter.
userPointerCustom pointer value that will be passed to the callback function.
Returns
True if audio data has been written to buffers, false otherwise.