Async 1.8.0
Async::AudioDelayLine Class Reference

This class implements an audio delay line. More...

#include <AsyncAudioDelayLine.h>

Inheritance diagram for Async::AudioDelayLine:
Async::AudioSink Async::AudioSource

Public Member Functions

 AudioDelayLine (int length_ms)
 Constuctor.
 
 ~AudioDelayLine (void)
 Destructor.
 
void setFadeTime (int time_ms)
 Set the fade in/out time when muting and clearing.
 
void mute (bool do_mute, int time_ms=0)
 Mute audio.
 
void clear (int time_ms=-1)
 Clear samples in the delay line.
 
int writeSamples (const float *samples, int count)
 Write samples into the delay line.
 
void flushSamples (void)
 Tell the sink to flush the previously written samples.
 
void resumeOutput (void)
 Resume audio output to the sink.
 
void allSamplesFlushed (void)
 The registered sink has flushed all 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.
 

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
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

This class implements an audio delay line.

Author
Tobias Blomberg / SM0SVX
Date
2006-07-08

This class implements an audio delay line. It simply delays the audio with the specified amount of time. This can be useful if you want to mute audio based on a slow detector. With a delay line you have the possibility to mute audio that have passed the detector but have not yet passed through the delay line.

Definition at line 117 of file AsyncAudioDelayLine.h.

Constructor & Destructor Documentation

◆ AudioDelayLine()

Async::AudioDelayLine::AudioDelayLine ( int length_ms)
explicit

Constuctor.

Parameters
length_msThe length in milliseconds of the delay line

◆ ~AudioDelayLine()

Async::AudioDelayLine::~AudioDelayLine ( void )

Destructor.

Member Function Documentation

◆ allSamplesFlushed()

void Async::AudioDelayLine::allSamplesFlushed ( void )
virtual

The registered sink has flushed all samples.

This function must be implemented by the inheriting class. It will be called when all samples have been flushed in the registered sink. This function is normally only called from a connected sink object.

Reimplemented from Async::AudioSource.

◆ clear()

void Async::AudioDelayLine::clear ( int time_ms = -1)

Clear samples in the delay line.

Parameters
time_msHow much time in milliseconds to clear

Will clear the specified amount of samples in the delay line. If a clear is issued right before the delay line is flushed, the cleared samples will not be flushed. They will be thrown away.

◆ flushSamples()

void Async::AudioDelayLine::flushSamples ( void )
virtual

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.

◆ mute()

void Async::AudioDelayLine::mute ( bool do_mute,
int time_ms = 0 )

Mute audio.

Parameters
do_muteIf true mute else unmute
time_msHow much more time in milliseconds to mute (see below)

This function is used to mute audio in the delay line. With time_ms equal to zero its function is trivial. Mute incoming audio until mute is called with do_mute = false. The time_ms paramter specify how much time before (do_mute = true) or time after (do_mute = false) should be muted. Negative values are not allowed.

◆ resumeOutput()

void Async::AudioDelayLine::resumeOutput ( void )
virtual

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

◆ setFadeTime()

void Async::AudioDelayLine::setFadeTime ( int time_ms)

Set the fade in/out time when muting and clearing.

Parameters
time_msThe time in milliseconds for the fade in/out

When a mute or clear is issued the audio stream will not abruptly go to zero. Instead it will fade in and out smoothly to avoid popping sounds due to discontinueties in the sample stream. The default is 10 milliseconds. Set to 0 to turn off.

◆ writeSamples()

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

Write samples into the delay line.

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 will write samples into the delay line. It's normally only called from a connected source object.

Reimplemented from Async::AudioSink.


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