Async 1.8.0
|
The base class for an audio sink. More...
#include <AsyncAudioSink.h>
Public Member Functions | |
AudioSink (void) | |
Default constuctor. | |
virtual | ~AudioSink (void) |
Destructor. | |
bool | registerSource (AudioSource *source) |
Register an audio source to provide samples to this sink. | |
void | unregisterSource (void) |
Unregister the previously registered audio source. | |
bool | isRegistered (void) const |
Check if an audio source has been registered. | |
AudioSource * | source (void) const |
Get the registered audio source. | |
virtual int | writeSamples (const float *samples, int count) |
Write samples into this audio sink. | |
virtual void | flushSamples (void) |
Tell the sink to flush the previously written samples. | |
Protected Member Functions | |
void | sourceResumeOutput (void) |
Tell the source that we are ready to accept more samples. | |
void | sourceAllSamplesFlushed (void) |
Tell the source that all samples have been flushed. | |
bool | setHandler (AudioSink *handler) |
Setup another sink to handle the incoming audio. | |
void | clearHandler (void) |
Clear a handler that was previously setup with setHandler. | |
AudioSink * | handler (void) const |
The base class for an audio sink.
This is the base class for an audio sink. An audio sink is a class that can consume audio.
Definition at line 115 of file AsyncAudioSink.h.
|
inline |
Default constuctor.
Definition at line 121 of file AsyncAudioSink.h.
|
virtual |
Destructor.
|
protected |
Clear a handler that was previously setup with setHandler.
|
inlinevirtual |
Tell the sink to flush the previously written samples.
This function is used to tell the sink to flush previously written samples. When done flushing, the sink should call the sourceAllSamplesFlushed function. This function is normally only called from a connected source object.
Reimplemented in Async::AudioContainerPcm, Async::AudioContainerWav, Async::AudioDebugger, Async::AudioDelayLine, Async::AudioEncoder, Async::AudioFifo, Async::AudioJitterFifo, Async::AudioPacer, Async::AudioPassthrough, Async::AudioProcessor, Async::AudioReader, Async::AudioRecorder, Async::AudioSplitter, Async::AudioStreamStateDetector, Async::AudioValve, and Async::SigCAudioSink.
Definition at line 178 of file AsyncAudioSink.h.
References flushSamples().
Referenced by Async::AudioContainer::endStream(), and flushSamples().
|
inlineprotected |
Definition at line 222 of file AsyncAudioSink.h.
|
inline |
Check if an audio source has been registered.
Definition at line 144 of file AsyncAudioSink.h.
bool Async::AudioSink::registerSource | ( | AudioSource * | source | ) |
Register an audio source to provide samples to this sink.
source | The audio source to use |
Referenced by Async::AudioDebugger::AudioDebugger().
|
protected |
Setup another sink to handle the incoming audio.
handler | The sink to handle the audio |
This function will setup another sink to handle incoming audio. This can be used when an internal object should handle the audio for this object.
|
inline |
Get the registered audio source.
Definition at line 151 of file AsyncAudioSink.h.
|
protected |
Tell the source that all samples have been flushed.
This function is called by the inheriting class to indicate that all samples have been flushed. It may only be called after a flushSamples call has been received and no more samples has been written to the sink.
Referenced by Async::AudioEncoder::allEncodedSamplesFlushed(), Async::AudioDebugger::allSamplesFlushed(), Async::AudioPassthrough::allSamplesFlushed(), Async::AudioValve::allSamplesFlushed(), Async::SigCAudioSink::allSamplesFlushed(), Async::AudioValve::flushSamples(), and Async::AudioValve::setOpen().
|
protected |
Tell the source that we are ready to accept more samples.
Referenced by Async::AudioDebugger::resumeOutput(), Async::AudioPassthrough::resumeOutput(), Async::AudioValve::resumeOutput(), Async::SigCAudioSink::resumeOutput(), Async::AudioValve::setBlockWhenClosed(), and Async::AudioValve::setOpen().
void Async::AudioSink::unregisterSource | ( | void | ) |
Unregister the previously registered audio source.
|
inlinevirtual |
Write samples into this audio sink.
samples | The buffer containing the samples |
count | The number of samples in the buffer |
This function is used to write audio into this audio sink. If it returns 0, no more samples should be written until the resumeOutput function in the source have been called. This function is normally only called from a connected source object.
Reimplemented in Async::AudioContainerPcm, Async::AudioContainerWav, Async::AudioDebugger, Async::AudioDelayLine, Async::AudioFifo, Async::AudioJitterFifo, Async::AudioPacer, Async::AudioPassthrough, Async::AudioProcessor, Async::AudioReader, Async::AudioRecorder, Async::AudioSplitter, Async::AudioStreamStateDetector, Async::AudioValve, and Async::SigCAudioSink.
Definition at line 164 of file AsyncAudioSink.h.
References writeSamples().
Referenced by writeSamples().