Async 1.8.0
Async::AudioSplitter Class Reference

A class that splits an audio stream into multiple streams. More...

#include <AsyncAudioSplitter.h>

Inheritance diagram for Async::AudioSplitter:
Async::AudioSink Async::AudioSource

Public Member Functions

 AudioSplitter (void)
 Default constuctor.
 
 ~AudioSplitter (void)
 Destructor.
 
void addSink (AudioSink *sink, bool managed=false)
 Add an audio sink to the splitter.
 
void removeSink (AudioSink *sink)
 Remove an audio sink from the splitter.
 
void removeAllSinks (void)
 Remove all audio sinks from this splitter.
 
void enableSink (AudioSink *sink, bool enable)
 Enable or disable audio output to the given audio sink.
 
int writeSamples (const float *samples, int len) override
 Write samples into this audio sink.
 
void flushSamples (void) override
 Tell the sink to flush the previously written samples.
 
- Public Member Functions inherited from Async::AudioSink
 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.
 
- 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.
 
virtual void resumeOutput (void)
 Resume audio output to the sink.
 

Friends

class Branch
 

Additional Inherited Members

- Protected Member Functions inherited from Async::AudioSink
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
 
- Protected Member Functions inherited from Async::AudioSource
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

A class that splits an audio stream into multiple streams.

Author
Tobias Blomberg
Date
2005-05-05

This class is part of the audio pipe framework. It is used to split one incoming audio source into multiple outgoing sources.

Examples
AsyncAudioContainer_demo.cpp.

Definition at line 117 of file AsyncAudioSplitter.h.

Constructor & Destructor Documentation

◆ AudioSplitter()

Async::AudioSplitter::AudioSplitter ( void )

Default constuctor.

◆ ~AudioSplitter()

Async::AudioSplitter::~AudioSplitter ( void )

Destructor.

Member Function Documentation

◆ addSink()

void Async::AudioSplitter::addSink ( AudioSink * sink,
bool managed = false )

Add an audio sink to the splitter.

Parameters
sinkThe sink object to add
managedIf managed is true the attached sink will be deleted when the splitter is deleted
Examples
AsyncAudioContainer_demo.cpp.

◆ enableSink()

void Async::AudioSplitter::enableSink ( AudioSink * sink,
bool enable )

Enable or disable audio output to the given audio sink.

Parameters
sinkThe audio sink to enable/disable
enableSet to true to enable the sink or false to disable it

◆ flushSamples()

void Async::AudioSplitter::flushSamples ( void )
overridevirtual

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

◆ removeAllSinks()

void Async::AudioSplitter::removeAllSinks ( void )

Remove all audio sinks from this splitter.

◆ removeSink()

void Async::AudioSplitter::removeSink ( AudioSink * sink)

Remove an audio sink from the splitter.

Parameters
sinkThe sink object to remove

◆ writeSamples()

int Async::AudioSplitter::writeSamples ( const float * samples,
int len )
overridevirtual

Write samples into this audio sink.

Parameters
samplesThe buffer containing the samples
lenThe 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 from Async::AudioSink.

Friends And Related Symbol Documentation

◆ Branch

friend class Branch
friend

Definition at line 198 of file AsyncAudioSplitter.h.


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