Twitch SDK (Internal)
Public Member Functions | List of all members
ttv::IAudioConverter Class Referenceabstract

#include <audioconverter.h>

Inheritance diagram for ttv::IAudioConverter:
ttv::AudioConverter< InputBufferFormat, OutputBufferFormat, AudioConvertOptions >

Public Member Functions

virtual void BindInputBuffer (const void *buffer, SampleRange range)=0
 
virtual SampleRange GetOutputSampleRange () const =0
 
virtual SampleRange TransferToOutputBuffer (void *buffer, SampleRange range)=0
 
virtual void UnbindInputBuffer ()=0
 

Detailed Description

An interface for converting PCM audio data from one format to another.

Note that some of the operations during audio conversion may require some data to be maintained from the previous binding. Hence, unbinding the buffer may result in some portion of the samples at the end of the range being copied into an internal buffer. In order to maintain continuity of the converter's output, the client must bind contiguous input buffers in chronological order. Otherwise, the output data may contain gaps.

Member Function Documentation

◆ BindInputBuffer()

virtual void ttv::IAudioConverter::BindInputBuffer ( const void *  buffer,
SampleRange  range 
)
pure virtual

Binds a buffer of input data to converter. Calling this function when an input buffer is already bound to the converter is undefined behavior.

Parameters
bufferThe input buffer to bind.
rangeThe range of values, in the input buffer format's domain, that is represented by the input buffer.

Implemented in ttv::AudioConverter< InputBufferFormat, OutputBufferFormat, AudioConvertOptions >.

◆ GetOutputSampleRange()

virtual SampleRange ttv::IAudioConverter::GetOutputSampleRange ( ) const
pure virtual

Returns the range, in the output buffer format's domain, that is currently available in the converter. Calling this function when an input buffer is not bound is undefined behavior.

Returns
The range of values that can be transferred.

Implemented in ttv::AudioConverter< InputBufferFormat, OutputBufferFormat, AudioConvertOptions >.

◆ TransferToOutputBuffer()

virtual SampleRange ttv::IAudioConverter::TransferToOutputBuffer ( void *  buffer,
SampleRange  range 
)
pure virtual

Transfers data to the passed output buffer. Calling this function when an input buffer is not bound to the converter is undefined behavior. This function will transfer data in a range that is available for reading (from the converter) and writing (the passed sample range), i.e. the intersection of the two ranges. If no data was transferred, this function will return a range of {0, 0}

Parameters
bufferThe output buffer to transfer data into.
rangeThe range of values, in the output buffer format's domain, that is represented by the output buffer.
Returns
The range of values that was written.

Implemented in ttv::AudioConverter< InputBufferFormat, OutputBufferFormat, AudioConvertOptions >.

◆ UnbindInputBuffer()

virtual void ttv::IAudioConverter::UnbindInputBuffer ( )
pure virtual

Unbinds the currently bound buffer of input data. Calling this function when an input buffer is not bound to the converter is undefined behavior.

Implemented in ttv::AudioConverter< InputBufferFormat, OutputBufferFormat, AudioConvertOptions >.


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