Open 3D Engine AudioSystem Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
Audio::RingBuffer< SampleType, typename > Class Template Reference

Inherits Audio::RingBufferBase.

Public Member Functions

 AZ_CLASS_ALLOCATOR (RingBuffer< SampleType >, AZ::SystemAllocator)
 
 RingBuffer (size_t numSamples)
 
size_t AddData (const void *source, size_t numFrames, size_t numChannels) override
 
size_t AddMultiTrackDataInterleaved (const void **source, size_t numFrames, size_t numChannels) override
 
size_t ConsumeData (void **dest, size_t numFrames, size_t numChannels, bool deinterleaveMultichannel) override
 
- Public Member Functions inherited from Audio::RingBufferBase
 AZ_CLASS_ALLOCATOR (RingBufferBase, AZ::SystemAllocator)
 
 RingBufferBase (const size_t numSamples)
 
virtual size_t AddData (const void *source, size_t numFrames, size_t numChannels)=0
 
virtual size_t AddMultiTrackDataInterleaved (const void **source, size_t numFrames, size_t numChannels)
 
virtual size_t ConsumeData (void **dest, size_t numFrames, size_t numChannels, bool deinterleaveMultichannel=false)=0
 
virtual void ResetBuffer ()=0
 

Static Public Attributes

static const size_t s_bytesPerSample = sizeof(SampleType)
 

Protected Member Functions

void ResetBuffer () override
 
void AllocateData (size_t numSamples)
 
void DeallocateData ()
 
size_t SamplesReady () const
 
size_t SamplesUnused () const
 

Member Function Documentation

◆ AddData()

template<typename SampleType , typename = AZStd::enable_if_t<AZStd::is_arithmetic<SampleType>::value>>
size_t Audio::RingBuffer< SampleType, typename >::AddData ( const void *  source,
size_t  numFrames,
size_t  numChannels 
)
inlineoverridevirtual

Adds new data to the ringbuffer.

Parameters
sourceSource buffer to copy from.
numFramesNumber of sample frames available to copy.
numChannelsNumber of channels in the sample data, samples = numFrames * numChannels.
Returns
Number of sample frames copied.

Implements Audio::RingBufferBase.

◆ AddMultiTrackDataInterleaved()

template<typename SampleType , typename = AZStd::enable_if_t<AZStd::is_arithmetic<SampleType>::value>>
size_t Audio::RingBuffer< SampleType, typename >::AddMultiTrackDataInterleaved ( const void **  source,
size_t  numFrames,
size_t  numChannels 
)
inlineoverridevirtual

Adds new multi-track/multi-channel data to the ringbuffer in interleaved format. Not a required interface.

Parameters
sourceSource buffer to copy from.
numFramesNumber of sample frames available to copy.
numChannelsNumber of tracks/channels in the source data, numSamples = numFrames * numChannels.
Returns
Number of sample frames copied.

Reimplemented from Audio::RingBufferBase.

◆ ConsumeData()

template<typename SampleType , typename = AZStd::enable_if_t<AZStd::is_arithmetic<SampleType>::value>>
size_t Audio::RingBuffer< SampleType, typename >::ConsumeData ( void **  dest,
size_t  numFrames,
size_t  numChannels,
bool  deinterleaveMultichannel 
)
inlineoverridevirtual

Consumes stored data from the ringbuffer.

Parameters
destWhere the data will be written to, typically an array of SampleType pointers.
numFramesNumber of sample frames requested to consume.
numChannelsNumber of channels laid out in the dest parameter.
deinterleaveMultichannelIn the case of multichannel data, if true do a deinterleaved copy into the dest array channels otherwise straight copy into dest[0].
Returns
Number of sample frames consumed.

Implements Audio::RingBufferBase.

◆ ResetBuffer()

template<typename SampleType , typename = AZStd::enable_if_t<AZStd::is_arithmetic<SampleType>::value>>
void Audio::RingBuffer< SampleType, typename >::ResetBuffer ( )
inlineoverrideprotectedvirtual

Zeros the ringbuffer data and resets indices.

Implements Audio::RingBufferBase.


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