SoundFontInfoLib  2.21.6
Library for parsing and rendering SF2 files
SF2::Render::InputBuffer Struct Reference

Maintains a buffer of PCM samples which is used to save samples from an upstream node. More...

#include <InputBuffer.hpp>

Public Member Functions

void allocateBuffers (AVAudioFormat *format, AUAudioFrameCount maxFrames)
 Set the format of the buffer to use. More...
 
void releaseBuffers ()
 Forget any allocated buffers. More...
 
AUAudioUnitStatus pullInput (AudioUnitRenderActionFlags *actionFlags, AudioTimeStamp const *timestamp, AVAudioFrameCount frameCount, NSInteger inputBusNumber, AURenderPullInputBlock pullInputBlock)
 Obtain samples from an upstream node. More...
 
void prepareBufferList (AVAudioFrameCount frameCount)
 Update the input buffer to reflect current format. More...
 
AudioBufferList * mutableAudioBufferList () const
 Obtain a pointer to a mutable version of the internal channel buffers. More...
 
BufferFacetbufferFacet ()
 Obtain the BufferFacet that manages the held AudioBufferList and provides a std::vector view of them. More...
 
size_t channelCount () const
 Obtain the number of input channels. More...
 
AUValue * operator[] (size_t index) const
 Obtain the channel buffer. More...
 

Detailed Description

Maintains a buffer of PCM samples which is used to save samples from an upstream node.

Note that despite its name, there are multiple sample buffers held within, one for each channel of input.

Member Function Documentation

◆ allocateBuffers()

void SF2::Render::InputBuffer::allocateBuffers ( AVAudioFormat *  format,
AUAudioFrameCount  maxFrames 
)
inline

Set the format of the buffer to use.

Parameters
formatthe format of the samples
maxFramesthe maximum number of frames to be found in the upstream output

References SF2::Render::BufferFacet::setBufferList().

◆ bufferFacet()

BufferFacet& SF2::Render::InputBuffer::bufferFacet ( )
inline

Obtain the BufferFacet that manages the held AudioBufferList and provides a std::vector view of them.

◆ channelCount()

size_t SF2::Render::InputBuffer::channelCount ( ) const
inline

Obtain the number of input channels.

Returns
channel count

References SF2::Render::BufferFacet::channelCount().

◆ mutableAudioBufferList()

AudioBufferList* SF2::Render::InputBuffer::mutableAudioBufferList ( ) const
inline

Obtain a pointer to a mutable version of the internal channel buffers.

Returns
AudioBufferList pointer.

◆ operator[]()

AUValue* SF2::Render::InputBuffer::operator[] ( size_t  index) const
inline

Obtain the channel buffer.

Returns
writable pointer to a channel buffer

◆ prepareBufferList()

void SF2::Render::InputBuffer::prepareBufferList ( AVAudioFrameCount  frameCount)
inline

Update the input buffer to reflect current format.

Parameters
frameCountthe number of frames to expect to place in the buffer

References channel.

Referenced by pullInput().

◆ pullInput()

AUAudioUnitStatus SF2::Render::InputBuffer::pullInput ( AudioUnitRenderActionFlags *  actionFlags,
AudioTimeStamp const *  timestamp,
AVAudioFrameCount  frameCount,
NSInteger  inputBusNumber,
AURenderPullInputBlock  pullInputBlock 
)
inline

Obtain samples from an upstream node.

Output is stored in internal buffer.

Parameters
actionFlagsrender flags from the host
timestampthe current transport time of the samples
frameCountthe number of frames to process
inputBusNumberthe bus to pull from
pullInputBlockthe function to call to do the pulling

References prepareBufferList().

◆ releaseBuffers()

void SF2::Render::InputBuffer::releaseBuffers ( )
inline

Forget any allocated buffers.

References SF2::Render::BufferFacet::release().


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