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

Renders an audio file through an audio graph then saves the output to another audio file. More...

#include <OfflineGraphRenderer.hpp>

Classes

struct  AudioFile
 Audio file for OfflineGraphRenderer. More...
 

Public Member Functions

 OfflineGraphRenderer ()
 
void processGraph (switchboard::AudioGraph &graph)
 Renders an audio graph.
 
double getMaxNumberOfSecondsToRender () const
 Gets the maximum duration of the rendered audio data. The renderer will finish whenever it reads this many seconds from the input audio file or when it reaches the end of the input audio file.
 
void setMaxNumberOfSecondsToRender (const double maxNumberOfSecondsToRender)
 Sets the maximum number of seconds to render.
 
uint getSampleRate () const
 Gets the processing sample rate of the audio graph. SAMPLE_RATE_UNDEFINED means that the sample rate of the input audio file will be used. Default: SAMPLE_RATE_UNDEFINED.
 
void setSampleRate (const uint sampleRate)
 Sets the processing sample rate of the audio graph.
 
uint getBufferDurationMs () const
 Gets the duration of the audio buffers that will be used to process the audio graph. Default: 10 ms.
 
void setBufferDurationMs (const uint bufferDurationMs)
 Sets the duration of the audio buffers that will be used to process the audio graph.
 
void * getUserPointer () const
 Gets the pointer value that will be passed back in the callback functions as a parameter. Default: nullptr.
 
void setUserPointer (void *userPointer)
 Sets the pointer value that will be passed back in the callback functions as a parameter.
 
void setProgressUpdateFunction (ProgressUpdateFunction progressUpdateFunction)
 Sets the callback function that is called to report back the progress of the rendering process.
 

Public Attributes

std::vector< AudioFileinputFiles
 Input files for the OfflineGraphRenderer. Each input file will appear as an input audio bus on the processed AudioGraph.
 
std::vector< AudioFileoutputFiles
 Output files for the OfflineGraphRenderer. Each output file will appear as an output audio bus on the processed AudioGraph.
 

Detailed Description

Renders an audio file through an audio graph then saves the output to another audio file.

OfflineGraphRenderer class.

Constructor & Destructor Documentation

◆ OfflineGraphRenderer()

switchboard::OfflineGraphRenderer::OfflineGraphRenderer ( )

OfflineGraphRenderer constructor.

Member Function Documentation

◆ getBufferDurationMs()

uint switchboard::OfflineGraphRenderer::getBufferDurationMs ( ) const

Gets the duration of the audio buffers that will be used to process the audio graph. Default: 10 ms.

Returns
The duration of the audio buffers in milliseconds.

◆ getMaxNumberOfSecondsToRender()

double switchboard::OfflineGraphRenderer::getMaxNumberOfSecondsToRender ( ) const

Gets the maximum duration of the rendered audio data. The renderer will finish whenever it reads this many seconds from the input audio file or when it reaches the end of the input audio file.

Returns
The maximum number of seconds to render.

◆ getSampleRate()

uint switchboard::OfflineGraphRenderer::getSampleRate ( ) const

Gets the processing sample rate of the audio graph. SAMPLE_RATE_UNDEFINED means that the sample rate of the input audio file will be used. Default: SAMPLE_RATE_UNDEFINED.

Returns
The processing sample rate of the audio graph.

◆ getUserPointer()

void * switchboard::OfflineGraphRenderer::getUserPointer ( ) const

Gets the pointer value that will be passed back in the callback functions as a parameter. Default: nullptr.

Returns
The current user pointer.

◆ processGraph()

void switchboard::OfflineGraphRenderer::processGraph ( switchboard::AudioGraph & graph)

Renders an audio graph.

Parameters
graphThe audio graph to render.

◆ setBufferDurationMs()

void switchboard::OfflineGraphRenderer::setBufferDurationMs ( const uint bufferDurationMs)

Sets the duration of the audio buffers that will be used to process the audio graph.

Parameters
bufferDurationMsThe new duration of the audio buffers in milliseconds.

◆ setMaxNumberOfSecondsToRender()

void switchboard::OfflineGraphRenderer::setMaxNumberOfSecondsToRender ( const double maxNumberOfSecondsToRender)

Sets the maximum number of seconds to render.

Parameters
maxNumberOfSecondsToRenderThe new maximum number of seconds to render.

◆ setProgressUpdateFunction()

void switchboard::OfflineGraphRenderer::setProgressUpdateFunction ( ProgressUpdateFunction progressUpdateFunction)

Sets the callback function that is called to report back the progress of the rendering process.

Parameters
progressUpdateFunctionThe new progress update function. nullptr can be passed in the clear the currently set function.

◆ setSampleRate()

void switchboard::OfflineGraphRenderer::setSampleRate ( const uint sampleRate)

Sets the processing sample rate of the audio graph.

Parameters
sampleRateThe new processing sample rate of the audio graph.

◆ setUserPointer()

void switchboard::OfflineGraphRenderer::setUserPointer ( void * userPointer)

Sets the pointer value that will be passed back in the callback functions as a parameter.

Parameters
userPointerThe new user pointer.