Switchboard SDK
Loading...
Searching...
No Matches
switchboard::AudioData< T > Class Template Referencefinal

Provides helper methods to handle raw audio data arrays. More...

#include <AudioData.hpp>

Public Member Functions

WASM AudioData (const uint maxNumberOfChannels, const uint maxNumberOfFrames)
 Creates an AudioData instance that allocates and owns maxNumberOfChannels * maxNumberOfFrames * sizeof(T) bytes.
 
WASM ~AudioData () noexcept
 AudioData destructor.
 
WASM T * getBuffer ()
 Returns a pointer to the internal allocated audio memory location.
 
WASM T ** getBuffers ()
 Returns a pointer to the stacked audio memory location.
 

Detailed Description

template<typename T>
class switchboard::AudioData< T >

Provides helper methods to handle raw audio data arrays.

Audio data class.

Constructor & Destructor Documentation

◆ AudioData()

template<typename T >
switchboard::AudioData< T >::AudioData ( const uint maxNumberOfChannels,
const uint maxNumberOfFrames )

Creates an AudioData instance that allocates and owns maxNumberOfChannels * maxNumberOfFrames * sizeof(T) bytes.

This constructor is not realtime-safe as it allocates memory.

The allocated buffer is filled with zeros.

Parameters
maxNumberOfChannelsThe maximum number of channels.
maxNumberOfFramesThe maximum number of frames.

Member Function Documentation

◆ getBuffer()

template<typename T >
T * switchboard::AudioData< T >::getBuffer ( )

Returns a pointer to the internal allocated audio memory location.

Returns
Pointer to the internal allocated audio memory location.

◆ getBuffers()

template<typename T >
T ** switchboard::AudioData< T >::getBuffers ( )

Returns a pointer to the stacked audio memory location.

This returns a pointer to a list of per-channel memory locations that have the same memory location as getBuffer().

This makes it possible to iterate over the channels of the buffer.

Returns
Pointer to the stacked audio memory location.