NAP
Public Member Functions | Public Attributes | List of all members
MultiSampleBuffer Class Reference

#include <audio/utility/audiotypes.h>

Public Member Functions

 MultiSampleBuffer ()=default
 
 MultiSampleBuffer (std::size_t channelCount, std::size_t size)
 
SampleBufferoperator[] (std::size_t index)
 
std::size_t getChannelCount () const
 
std::size_t getSize () const
 
void resize (std::size_t channelCount, std::size_t size)
 
void reserve (std::size_t channelCount, std::size_t size)
 
void clear ()
 

Public Attributes

std::vector< SampleBufferchannels
 

Description

A collection of sample buffers, one for each channel to represent multichannel audio.

Constructor & Destructor Documentation

◆ MultiSampleBuffer() [1/2]

MultiSampleBuffer ( )
default

◆ MultiSampleBuffer() [2/2]

MultiSampleBuffer ( std::size_t  channelCount,
std::size_t  size 
)
Parameters
channelCountnumber of channels in this buffer
sizesize of the buffer in samples

Member Function Documentation

◆ clear()

void clear ( )

Clear the content of the buffer.

◆ getChannelCount()

std::size_t getChannelCount ( ) const
Returns
: number of channels in the buffer

◆ getSize()

std::size_t getSize ( ) const
Returns
: the size of the buffer in samples

◆ operator[]()

SampleBuffer& operator[] ( std::size_t  index)

Used to access the samples in the buffer example: myBuffer[channelNumber][sampleIndex]

◆ reserve()

void reserve ( std::size_t  channelCount,
std::size_t  size 
)

Reserve capacity of the buffer in memory to prevent repeated memory allocation

Parameters
channelCountnew number of channels capacity
sizenew size in samples capacity

◆ resize()

void resize ( std::size_t  channelCount,
std::size_t  size 
)

Resize the buffer

Parameters
channelCountnew number of channels
sizenew size in samples

Member Data Documentation

◆ channels

std::vector<SampleBuffer> channels