Async 1.8.0
Async::AudioSelector Class Reference

This class is used to select one of many audio streams. More...

#include <AsyncAudioSelector.h>

Inheritance diagram for Async::AudioSelector:
Async::AudioSource

Public Member Functions

 AudioSelector (void)
 Default constuctor.
 
 ~AudioSelector (void)
 Destructor.
 
void addSource (AudioSource *source)
 Add an audio source to the selector.
 
void removeSource (AudioSource *source)
 Remove a previously added audio source from the selector.
 
void setSelectionPrio (AudioSource *source, int prio)
 Set the prio to be used for selection.
 
void enableAutoSelect (AudioSource *source, int prio)
 Enable autoselection on the given source.
 
void disableAutoSelect (AudioSource *source)
 Disable autoselection on the given source.
 
bool autoSelectEnabled (const AudioSource *source) const
 Find out if auto select is enabled or not for the given source.
 
void selectSource (AudioSource *source)
 Select one of the previously added audio sources.
 
AudioSourceselectedSource (void) const
 Find out which source that is currently selected.
 
void setFlushWait (AudioSource *source, bool flush_wait)
 Set if this souce want to wait for allSamplesFlushed.
 
virtual void resumeOutput (void)
 Resume audio output to the sink.
 
- Public Member Functions inherited from Async::AudioSource
 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.
 

Protected Member Functions

virtual void allSamplesFlushed (void)
 The registered sink has flushed all samples.
 
- Protected Member Functions inherited from Async::AudioSource
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.
 

Friends

class Branch
 

Detailed Description

This class is used to select one of many audio streams.

Author
Tobias Blomberg / SM0SVX
Date
2006-08-01

This class is used to select one of many incoming audio streams. Incoming samples on non-selected branches will be thrown away.

Definition at line 114 of file AsyncAudioSelector.h.

Constructor & Destructor Documentation

◆ AudioSelector()

Async::AudioSelector::AudioSelector ( void )

Default constuctor.

◆ ~AudioSelector()

Async::AudioSelector::~AudioSelector ( void )

Destructor.

Member Function Documentation

◆ addSource()

void Async::AudioSelector::addSource ( AudioSource * source)

Add an audio source to the selector.

Parameters
sourceThe audio source to add

◆ allSamplesFlushed()

virtual void Async::AudioSelector::allSamplesFlushed ( void )
protectedvirtual

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 from Async::AudioSource.

◆ autoSelectEnabled()

bool Async::AudioSelector::autoSelectEnabled ( const AudioSource * source) const

Find out if auto select is enabled or not for the given source.

Parameters
sourceThe audio source
Returns
Returns true if auto select is enabled for the given source or else false is returned

◆ disableAutoSelect()

void Async::AudioSelector::disableAutoSelect ( AudioSource * source)

Disable autoselection on the given source.

Parameters
sourceThe audio source

◆ enableAutoSelect()

void Async::AudioSelector::enableAutoSelect ( AudioSource * source,
int prio )

Enable autoselection on the given source.

Parameters
sourceThe audio source
prioThe priority to set. Higher numbers give higher priority.

◆ removeSource()

void Async::AudioSelector::removeSource ( AudioSource * source)

Remove a previously added audio source from the selector.

Parameters
sourceThe audio source to remove

◆ resumeOutput()

virtual void Async::AudioSelector::resumeOutput ( void )
virtual

Resume audio output to the sink.

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

Reimplemented from Async::AudioSource.

◆ selectedSource()

AudioSource * Async::AudioSelector::selectedSource ( void ) const

Find out which source that is currently selected.

Returns
Returns the selected source or 0 if no source is selected

◆ selectSource()

void Async::AudioSelector::selectSource ( AudioSource * source)

Select one of the previously added audio sources.

Parameters
sourceThe audio source to select. 0 = none selected.

◆ setFlushWait()

void Async::AudioSelector::setFlushWait ( AudioSource * source,
bool flush_wait )

Set if this souce want to wait for allSamplesFlushed.

Parameters
sourceThe audio source to select. 0 = none selected.
flush_waitSet to true to wait for flush or else false

Normally after a source signals flush, the audio selector will wait until the connected sink signals that all samples have been flushed before any other source with the same or lower priority can be selected. If flush_wait is set to false, the selector will immediately signal all samples flushed to the source and if any other source is active, that source will immediately be switched in without sending a flush command to the sink.

◆ setSelectionPrio()

void Async::AudioSelector::setSelectionPrio ( AudioSource * source,
int prio )

Set the prio to be used for selection.

Parameters
sourceThe audio source
prioThe priority to set. Higher numbers give higher priority.

Friends And Related Symbol Documentation

◆ Branch

friend class Branch
friend

Definition at line 227 of file AsyncAudioSelector.h.


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