AtlatestRepositorysigil-audio
sigil-audio / tree / src / caudio-stream.h
1
/*2
* audio-stream.h - Streaming audio sink for sigil-audio3
*4
* SPSC lockless ring buffer from any Sigil thread (producer) to5
* the playback device's callback thread (miniaudio; consumer). See6
* folio topics/sigil-audio-streaming-sink-architecture.7
*/9
#ifndef SIGIL_AUDIO_STREAM_H10
#define SIGIL_AUDIO_STREAM_H12
#include "sigil/sigil.h"14
/* The playback device's rate: audio.c opens the device at it, and a stream15
* fed below it (audio-stream set-rate) is upsampled to it. */16
#define SIGIL_AUDIO_DEVICE_RATE 4410018
/* Called from the audio callback (audio.c) after play-sound / play-music19
* mixing. Drains each registered stream into the output buffer, padding20
* with silence on under-run. Stream mix is additive. */21
void sigil_audio_stream_mix_all(float *out, int num_frames, int out_channels);23
/* Register natives into the current module; called from audio.c init. */24
void sigil__register_audio_stream(SigilVM *vm);26
/* Called from audio-shutdown to stop and detach all streams. Frees no27
* memory — stream handles stay alive via GC, but are marked closed. */28
void sigil_audio_stream_shutdown_all(void);30
#endif