struct CCL::IBufferedAudioSink
Overview
Realtime-friendly buffered audio sink for a producer that must not block on a wrapped sink. More…
#include <iaudiosource.h> struct IBufferedAudioSink: public CCL::IWrappedAudioSink { // methods virtual tresult CCL_API resize (int capacity) = 0; virtual int CCL_API getCapacity () const = 0; virtual tresult CCL_API flush (IProgressNotify* progress = nullptr) = 0; virtual int CCL_API getBufferedAmount () const = 0; };
Inherited Members
public: // methods virtual tresult CCL_API queryInterface (UIDRef iid, void** ptr) = 0; virtual unsigned int CCL_API retain () = 0; virtual unsigned int CCL_API release () = 0; virtual int CCL_API getNumChannels () const = 0; virtual SampleRate CCL_API getSampleRate () const = 0; virtual TSamples CCL_API getFrameCount () const = 0; virtual SpeakerBitField CCL_API getSpeakerFormat () const = 0; IAudioContent TSeconds getDuration () const; virtual int CCL_API write (const AudioData& data, int sampleFrames) = 0; virtual tresult CCL_API setSink (IAudioSink* sink) = 0; virtual IAudioSink*CCL_API getSink () const = 0;
Detailed Documentation
Realtime-friendly buffered audio sink for a producer that must not block on a wrapped sink.
The caller is responsible for driving flush() from whatever thread it likes. setSink() /resize() are not safe to call while write() /flush() are concurrently in progress.
The write() method accept frames into the internal buffer without calling the wrapped sink and returns a partial frame count when the buffer is full; the caller owns the dropped remainder.
Methods
virtual tresult CCL_API resize (int capacity) = 0
Resize the internal buffer to hold the given capacity, in audio frames.
Discards any currently buffered data.
virtual int CCL_API getCapacity () const = 0
Get the total buffer capacity, in frames.
virtual tresult CCL_API flush (IProgressNotify* progress = nullptr) = 0
Push buffered data to the assigned sink, checks for cancelation via progress callback.
kResultOk : all currently buffered data was written kResultFalse : the assigned sink accepted only part of the buffered data kResultFailed : no sink is assigned or a sink error occurred kResultAborted : canceled via progress before completion.
virtual int CCL_API getBufferedAmount () const = 0
Get the number of frames currently buffered and awaiting flush.