AtlatestRepositorysigil-audio

sigil-audio / tree / src / caudio-stream.h

1/*
2 * audio-stream.h - Streaming audio sink for sigil-audio
3 *
4 * SPSC lockless ring buffer from any Sigil thread (producer) to
5 * the playback device's callback thread (miniaudio; consumer). See
6 * folio topics/sigil-audio-streaming-sink-architecture.
7 */
8
9#ifndef SIGIL_AUDIO_STREAM_H
10#define SIGIL_AUDIO_STREAM_H
12#include "sigil/sigil.h"
14/* The playback device's rate: audio.c opens the device at it, and a stream
15 * fed below it (audio-stream set-rate) is upsampled to it. */
16#define SIGIL_AUDIO_DEVICE_RATE 44100
18/* Called from the audio callback (audio.c) after play-sound / play-music
19 * mixing. Drains each registered stream into the output buffer, padding
20 * with silence on under-run. Stream mix is additive. */
21void 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. */
24void sigil__register_audio_stream(SigilVM *vm);
26/* Called from audio-shutdown to stop and detach all streams. Frees no
27 * memory — stream handles stay alive via GC, but are marked closed. */
28void sigil_audio_stream_shutdown_all(void);
30#endif