Async 1.8.0
Async::AudioSource Class Reference

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

#include <AsyncAudioSource.h>

Inheritance diagram for Async::AudioSource:
Async::AudioDebugger Async::AudioDecoder Async::AudioDelayLine Async::AudioFifo Async::AudioGenerator Async::AudioIO Async::AudioJitterFifo Async::AudioMixer Async::AudioPacer Async::AudioPassthrough Async::AudioProcessor Async::AudioSelector Async::AudioSplitter Async::AudioThreadSource Async::AudioValve Async::SigCAudioSource

Public Member Functions

 AudioSource (void)
 Default constuctor.
 
virtual ~AudioSource (void)
 Destructor.
 
bool registerSink (AudioSink *sink, bool managed=false)
 Register an audio sink to provide samples to.
 
void unregisterSink (void)
 Unregister the previously registered audio sink.
 
bool isRegistered (void) const
 Check if an audio sink has been registered.
 
AudioSinksink (void) const
 Get the registered audio sink.
 
bool sinkManaged (void) const
 Check if the sink is managed or not.
 
void handleAllSamplesFlushed (void)
 The registered sink has flushed all samples.
 
virtual void resumeOutput (void)
 Resume audio output to the sink.
 

Protected Member Functions

virtual void allSamplesFlushed (void)
 The registered sink has flushed all samples.
 
int sinkWriteSamples (const float *samples, int len)
 
void sinkFlushSamples (void)
 
bool setHandler (AudioSource *handler)
 Setup another source to handle the outgoing audio.
 
AudioSourcehandler (void) const
 
void clearHandler (void)
 Clear a handler that was previously setup with setHandler.
 

Detailed Description

The base class for an audio source.

Author
Tobias Blomberg
Date
2005-04-17

This is the base class for an audio source. An audio source is a class that can produce audio.

Examples
AsyncAudioFsf_demo.cpp, AsyncAudioIO_demo.cpp, and AsyncAudioLADSPAPlugin_demo.cpp.

Definition at line 114 of file AsyncAudioSource.h.

Constructor & Destructor Documentation

◆ AudioSource()

Async::AudioSource::AudioSource ( void )
inline

Default constuctor.

Definition at line 120 of file AsyncAudioSource.h.

◆ ~AudioSource()

virtual Async::AudioSource::~AudioSource ( void )
virtual

Destructor.

Member Function Documentation

◆ allSamplesFlushed()

virtual void Async::AudioSource::allSamplesFlushed ( void )
inlineprotectedvirtual

The registered sink has flushed all samples.

This function should be implemented by the inheriting class. It will be called when all samples have been flushed in the registered sink. If it is not reimplemented, a handler must be set that handle the function call. This function is normally only called from a connected sink object.

Reimplemented in Async::AudioDebugger, Async::AudioDecoder, Async::AudioDelayLine, Async::AudioFifo, Async::AudioGenerator, Async::AudioIO, Async::AudioJitterFifo, Async::AudioMixer, Async::AudioPacer, Async::AudioPassthrough, Async::AudioProcessor, Async::AudioSelector, Async::AudioStreamStateDetector, Async::AudioValve, and Async::SigCAudioSource.

Examples
AsyncAudioIO_demo.cpp.

Definition at line 206 of file AsyncAudioSource.h.

References handleAllSamplesFlushed().

Referenced by handleAllSamplesFlushed().

◆ clearHandler()

void Async::AudioSource::clearHandler ( void )
protected

Clear a handler that was previously setup with setHandler.

◆ handleAllSamplesFlushed()

void Async::AudioSource::handleAllSamplesFlushed ( void )
inline

The registered sink has flushed all samples.

This function will be called when all samples have been flushed in the registered sink. This function is normally only called from a connected sink object.

Definition at line 175 of file AsyncAudioSource.h.

References allSamplesFlushed().

Referenced by allSamplesFlushed().

◆ handler()

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

Definition at line 253 of file AsyncAudioSource.h.

◆ isRegistered()

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

Check if an audio sink has been registered.

Returns
Returns true if there is an audio sink registerd

Definition at line 149 of file AsyncAudioSource.h.

◆ registerSink()

bool Async::AudioSource::registerSink ( AudioSink * sink,
bool managed = false )

Register an audio sink to provide samples to.

Parameters
sinkThe audio sink to register
managedIf true, the registered sink will be destroyed when this object is destroyed.
Returns
Returns true on success or else false
Examples
AsyncAudioContainer_demo.cpp, AsyncAudioFsf_demo.cpp, and AsyncAudioLADSPAPlugin_demo.cpp.

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

◆ resumeOutput()

virtual void Async::AudioSource::resumeOutput ( void )
inlinevirtual

Resume audio output to the sink.

This function must be reimplemented by the inheriting class. It will be called when the registered audio sink is ready to accept more samples. This function is normally only called from a connected sink object.

Reimplemented in Async::AudioDebugger, Async::AudioDecoder, Async::AudioDelayLine, Async::AudioFifo, Async::AudioGenerator, Async::AudioIO, Async::AudioJitterFifo, Async::AudioMixer, Async::AudioPacer, Async::AudioPassthrough, Async::AudioProcessor, Async::AudioSelector, Async::AudioValve, and Async::SigCAudioSource.

Examples
AsyncAudioIO_demo.cpp.

Definition at line 189 of file AsyncAudioSource.h.

References resumeOutput().

Referenced by resumeOutput().

◆ setHandler()

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

Setup another source to handle the outgoing audio.

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

This function will setup another source to handle outgoing audio. This can be used when an internal object should handle the audio for this object.

◆ sink()

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

Get the registered audio sink.

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

Definition at line 156 of file AsyncAudioSource.h.

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

◆ sinkFlushSamples()

◆ sinkManaged()

bool Async::AudioSource::sinkManaged ( void ) const
inline

Check if the sink is managed or not.

Returns
Returns true if the sink is managed or false if not

This function is used to find out if the connected sink is managed or not. A managed sink will automatically be deleted when this source object is deleted.

Definition at line 166 of file AsyncAudioSource.h.

◆ sinkWriteSamples()

int Async::AudioSource::sinkWriteSamples ( const float * samples,
int len )
protected

◆ unregisterSink()

void Async::AudioSource::unregisterSink ( void )

Unregister the previously registered audio sink.


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