struct CCL::IBufferedAudioSource

Overview

Realtime-friendly buffered audio source for a consumer from a wrapped source that may block. More…

#include <iaudiosource.h>

struct IBufferedAudioSource: public CCL::IWrappedAudioSource
{
    // methods

    virtual tresult CCL_API resize (int capacity) = 0;
    virtual int CCL_API getCapacity () const = 0;
    virtual tresult CCL_API fill (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 read (AudioData& data, int sampleFrames) = 0;
    virtual TSamples CCL_API seek (TSamples position) = 0;
    virtual TSamples CCL_API tell () const = 0;
    virtual tresult CCL_API setSource (IAudioSource* source) = 0;
    virtual IAudioSource*CCL_API getSource () const = 0;

Detailed Documentation

Realtime-friendly buffered audio source for a consumer from a wrapped source that may block.

The caller is responsible for driving fill() from whatever thread it likes. setSource() /resize() are not safe to call while fill() /read() are concurrently in progress.

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 fill (IProgressNotify* progress = nullptr) = 0

Pull more data from the assigned source into the internal buffer, checks for cancelation via progress callback.

kResultOk : data was accepted or the buffer is simply already full kResultFalse : assigned source has no more data kResultFailed : a source error occured kResultAborted : canceled via progress before completion.

virtual int CCL_API getBufferedAmount () const = 0

Get the number of frames currently buffered and available to read.