AtlatestRepositorysigil-audio

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

1/*
2 * audio-device.h - the playback device (miniaudio-impl.c) as audio.c sees it
3 */
4
5#ifndef SIGIL_AUDIO_DEVICE_H
6#define SIGIL_AUDIO_DEVICE_H
7
8/* Fill `frames` frames of interleaved f32 samples for `channels` channels;
9 * runs on the device's own thread. */
10typedef void (*sigil_audio_stream_cb)(float *buffer, int frames, int channels);
12/* Open and start the playback device: 0 on success, -1 when no backend
13 * could be initialised or no device opened (already reported on stderr). */
14int sigil_audio_device_open(int sample_rate, int channels, int buffer_frames,
15 sigil_audio_stream_cb stream_cb);
16void sigil_audio_device_close(void);
18/* miniaudio's name for the backend in use ("PulseAudio", "ALSA", "JACK",
19 * "WASAPI", "Core Audio", ...), or NULL when no device is open. */
20const char *sigil_audio_device_backend(void);
22/* The backend as a lowercase symbol name for Scheme ("pulseaudio", "alsa",
23 * "jack", "wasapi", "dsound", "winmm", "coreaudio", "null", "other"), or
24 * NULL when no device is open. PipeWire desktops answer "pulseaudio"
25 * (pipewire-pulse): miniaudio has no PipeWire backend of its own. */
26const char *sigil_audio_device_backend_symbol(void);
28/* 1 when a device is open on a real backend, 0 on the Null backend (frames
29 * are consumed in silence) or with no device. */
30int sigil_audio_device_real(void);
32#endif /* SIGIL_AUDIO_DEVICE_H */