reactor-c 1.0
C Runtime for Lingua Franca
Loading...
Searching...
No Matches
audio_loop.h
Go to the documentation of this file.
1
37
38#ifndef AUDIO_LOOP_H
39#define AUDIO_LOOP_H
40
41#include "wave_file_reader.h" // Defines lf_waveform_t.
42#include "tag.h" // Defines instant_t.
43
44#ifndef SAMPLE_RATE
49#define SAMPLE_RATE 44100
50#endif
51
52#ifndef AUDIO_BUFFER_SIZE
57#define AUDIO_BUFFER_SIZE 4410 // 1/10 second, 100 msec
58#endif
59
60#ifndef BUFFER_DURATION_NS
65#define BUFFER_DURATION_NS 100000000LL
66#endif
67
68#ifndef NUM_CHANNELS
73#define NUM_CHANNELS 1 // 2 for stereo
74#endif
75
76#ifndef MAX_AMPLITUDE
81#define MAX_AMPLITUDE 32765
82#endif
83
84#ifndef NUM_NOTES
89#define NUM_NOTES 8 // Maximum number of notes that can play simultaneously.
90#endif
91
102
108
126
136void add_to_sound(int index_offset, double value);
137
138#endif // AUDIO_LOOP_H
int64_t instant_t
Time instant.
Definition tag.h:101
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_stop_audio_loop()
Stop the audio loop thread.
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 add_to_sound(int index_offset, double value)
Add the given value to the current write buffer at the specified index.
Waveform in 16-bit linear-PCM format.
Definition wave_file_reader.h:50
Time and tag definitions and functions for Lingua Franca.
instant_t start_time
Utility function for reading WAV audio files.