Async 1.8.0
Async::AudioSink Class Reference

The base class for an audio sink. More...

#include <AsyncAudioSink.h>

Inheritance diagram for Async::AudioSink:
Async::AudioContainer Async::AudioDebugger Async::AudioDelayLine Async::AudioEncoder Async::AudioFifo Async::AudioIO Async::AudioJitterFifo Async::AudioPacer Async::AudioPassthrough Async::AudioProcessor Async::AudioReader Async::AudioRecorder Async::AudioSplitter Async::AudioValve Async::SigCAudioSink

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.
 
AudioSourcesource (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.
 
AudioSinkhandler (void) const
 

Detailed Description

The base class for an audio sink.

Author
Tobias Blomberg
Date
2005-04-17

This is the base class for an audio sink. An audio sink is a class that can consume audio.

Examples
AsyncAudioContainer_demo.cpp, and AsyncAudioIO_demo.cpp.

Definition at line 115 of file AsyncAudioSink.h.

Constructor & Destructor Documentation

◆ AudioSink()

Async::AudioSink::AudioSink ( void )
inline

Default constuctor.

Definition at line 121 of file AsyncAudioSink.h.

◆ ~AudioSink()

virtual Async::AudioSink::~AudioSink ( void )
virtual

Destructor.

Member Function Documentation

◆ clearHandler()

void Async::AudioSink::clearHandler ( void )
protected

Clear a handler that was previously setup with setHandler.

Examples
AsyncAudioContainer_demo.cpp.

◆ flushSamples()

virtual void Async::AudioSink::flushSamples ( void )
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.

Examples
AsyncAudioIO_demo.cpp.

Definition at line 178 of file AsyncAudioSink.h.

References flushSamples().

Referenced by Async::AudioContainer::endStream(), and flushSamples().

◆ handler()

AudioSink * Async::AudioSink::handler ( void ) const
inlineprotected

Definition at line 222 of file AsyncAudioSink.h.

◆ isRegistered()

bool Async::AudioSink::isRegistered ( void ) const
inline

Check if an audio source has been registered.

Returns
Returns true if there is an audio source registerd

Definition at line 144 of file AsyncAudioSink.h.

◆ registerSource()

bool Async::AudioSink::registerSource ( AudioSource * source)

Register an audio source to provide samples to this sink.

Parameters
sourceThe audio source to use
Returns
Returns true on success or else false
Examples
AsyncAudioIO_demo.cpp.

Referenced by Async::AudioDebugger::AudioDebugger().

◆ setHandler()

bool Async::AudioSink::setHandler ( AudioSink * handler)
protected

Setup another sink to handle the incoming audio.

Parameters
handlerThe sink to handle the audio
Returns
Returns true on success or else false

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.

Examples
AsyncAudioContainer_demo.cpp.

◆ source()

AudioSource * Async::AudioSink::source ( void ) const
inline

Get the registered audio source.

Returns
Returns the registered audio source if any registered or else returns 0.

Definition at line 151 of file AsyncAudioSink.h.

◆ sourceAllSamplesFlushed()

void Async::AudioSink::sourceAllSamplesFlushed ( void )
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.

Examples
AsyncAudioIO_demo.cpp.

Referenced by Async::AudioEncoder::allEncodedSamplesFlushed(), Async::AudioDebugger::allSamplesFlushed(), Async::AudioPassthrough::allSamplesFlushed(), Async::AudioValve::allSamplesFlushed(), Async::SigCAudioSink::allSamplesFlushed(), Async::AudioValve::flushSamples(), and Async::AudioValve::setOpen().

◆ sourceResumeOutput()

void Async::AudioSink::sourceResumeOutput ( void )
protected

◆ unregisterSource()

void Async::AudioSink::unregisterSource ( void )

Unregister the previously registered audio source.

◆ writeSamples()

virtual int Async::AudioSink::writeSamples ( const float * samples,
int count )
inlinevirtual

Write samples into this audio sink.

Parameters
samplesThe buffer containing the samples
countThe number of samples in the buffer
Returns
Returns the number of samples that has been taken care of

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.

Examples
AsyncAudioIO_demo.cpp.

Definition at line 164 of file AsyncAudioSink.h.

References writeSamples().

Referenced by writeSamples().


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