This class implements an audio delay line. More...
#include <AsyncAudioDelayLine.h>
This class implements an audio delay line.
This class implements an audio delay line. It simple 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.
Async::AudioDelayLine::AudioDelayLine | ( | int | length_ms | ) | [explicit] |
Constuctor.
length_ms | The length in milliseconds of the delay line |
Async::AudioDelayLine::~AudioDelayLine | ( | void | ) |
Destructor.
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.
void Async::AudioDelayLine::clear | ( | int | time_ms = -1 |
) |
Clear samples in the delay line.
time_ms | How long 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 samles will not be flushed. They will be thrown away.
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.
void Async::AudioDelayLine::mute | ( | bool | do_mute, | |
int | time_ms = 0 | |||
) |
Mute audio.
do_mute | If true mute else unmute | |
time_ms | How 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.
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.
int Async::AudioDelayLine::writeSamples | ( | const float * | samples, | |
int | count | |||
) | [virtual] |
Write samples into the delay line.
samples | The buffer containing the samples | |
count | The number of samples in the buffer |
This function will write samples into the delay line. It's normally only called from a connected source object.
Reimplemented from Async::AudioSink.