![]() |
reactor-c 1.0
C Runtime for Lingua Franca
|
Utility function for playing audio on Linux or MacOS. More...
Go to the source code of this file.
Macros | |
| #define | AUDIO_BUFFER_SIZE 4410 |
| Size of the audio buffer. | |
| #define | BUFFER_DURATION_NS 100000000LL |
| Duration of the audio buffer. | |
| #define | MAX_AMPLITUDE 32765 |
| Maximum amplitude for audio playback. | |
| #define | NUM_CHANNELS 1 |
| Number of channels for audio playback. | |
| #define | NUM_NOTES 8 |
| Maximum number of notes that can play simultaneously. | |
| #define | SAMPLE_RATE 44100 |
| Sample rate for audio playback. | |
Functions | |
| void | add_to_sound (int index_offset, double value) |
| Add the given value to the current write buffer at the specified index. | |
| int | lf_play_audio_waveform (lf_waveform_t *waveform, float emphasis, instant_t start_time) |
| Play the specified waveform with the specified emphasis at the specified time. | |
| void | lf_start_audio_loop (instant_t start_time) |
| Start an audio loop thread that becomes ready to receive audio amplitude samples via add_to_sound(). | |
| void | lf_stop_audio_loop () |
| Stop the audio loop thread. | |
Utility function for playing audio on Linux or MacOS.
Audio functions for Linux or MacOS. To start an audio loop, call lf_start_audio_loop(), passing it the logical time at which you would like the loop to start. To play a waveform, call lf_play_audio_waveform(). A waveform may be synthesized or read from a .wav file using read_wave_file() (see wave_file_reader.h).
To use this, include the following in your target properties:
In addition, you need this in your Lingua Franca file: