Async 1.5.0
|
A class for generating periodic audio signals. More...
#include <AsyncAudioGenerator.h>
Public Types | |
enum | Waveform { SIN , SQUARE } |
The type of waveform to generate. More... | |
Public Member Functions | |
AudioGenerator (Waveform wf=SIN) | |
Contructor. | |
~AudioGenerator (void) | |
Destructor. | |
void | setWaveform (Waveform wf) |
Set which waveform to use. | |
void | setFq (double tone_fq) |
Set the audio frequency. | |
void | setPower (float pwr_db) |
Set the power of the generated signal. | |
void | enable (bool enable) |
Enable or disable the generator. | |
void | resumeOutput (void) |
Resume audio output to the sink. | |
void | allSamplesFlushed (void) |
The registered sink has flushed all samples. | |
![]() | |
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. | |
AudioSink * | sink (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. | |
Additional Inherited Members | |
![]() | |
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. | |
AudioSource * | handler (void) const |
void | clearHandler (void) |
Clear a handler that was previously setup with setHandler. | |
A class for generating periodic audio signals.
This class is used to generate periodic audio signals. Note that audio samples will be produced in an endless loop until the connected sink stop the flow. This means that a sink have to be connected before enabling the generator or the application will get stuck. There also must be some form of flow control downstream in the audio pipe. One way to get flow control, if there are none naturally, is to use an Async::AudioPacer.
Definition at line 117 of file AsyncAudioGenerator.h.
The type of waveform to generate.
Enumerator | |
---|---|
SIN | Sine wave. |
SQUARE | Square wave. |
Definition at line 123 of file AsyncAudioGenerator.h.
Contructor.
wf | The waveform to use ( |
Definition at line 132 of file AsyncAudioGenerator.h.
|
inline |
|
inlinevirtual |
The registered sink has flushed all samples.
This function is normally only called from a connected sink object.
Reimplemented from Async::AudioSource.
Definition at line 207 of file AsyncAudioGenerator.h.
|
inline |
Enable or disable the generator.
enable | Set to true to enable the generator or false to disable it |
Definition at line 183 of file AsyncAudioGenerator.h.
References enable().
Referenced by enable(), and ~AudioGenerator().
|
inlinevirtual |
Resume audio output to the sink.
This function is normally only called from a connected sink object.
Reimplemented from Async::AudioSource.
Definition at line 197 of file AsyncAudioGenerator.h.
|
inline |
Set the audio frequency.
tone_fq | The frequency in Hz |
Definition at line 160 of file AsyncAudioGenerator.h.
|
inline |
Set the power of the generated signal.
pwr_db | The power of the signal in dB |
Use this function to set the power of the generated signal. 0dB power is defined as a full-scale sine wave.
Definition at line 172 of file AsyncAudioGenerator.h.
|
inline |
Set which waveform to use.
wf | The waveform to use ( |
Definition at line 150 of file AsyncAudioGenerator.h.