std1.0.0-beta-7 SafeC docs

Module audio::audio_error

#include <std/audio/audio_error.h> source

audio & MIDI: the error value both APIs return.

std/audio reports failures the way the rest of std does (no exceptions): an operation returns an AudioError — 'code' is AUDIO_OK (0) on success or one of the AUDIO_ERR_* codes below, 'message' a human-readable line for the log (the backend's own error text where it has one: ALSA's snd_strerror(), an HRESULT, a Core Audio OSStatus) — or, when it also produces a value, a std::Result<T, AudioError> (see std/result.h):

struct Result<Audio, AudioError> r = std::Audio::open(AUDIO_API_UNSPECIFIED);
match (r.get_err()) { case some(e): printf("%s\n", e.message); case null: {} }

Shared by audio.h and midi.h.

Structs

AudioError

Functions

audio_error_nameThe fixed English name of an AUDIO_ERR_* code ("unsupported", ...).

Macros

AUDIO_OK
AUDIO_ERR_WARNINGnon-fatal (e.g. realtime priority refused)
AUDIO_ERR_UNSUPPORTEDthe API isn't compiled in / can't do this
AUDIO_ERR_NO_DEVICESno (default) device to use
AUDIO_ERR_INVALID_DEVICEno device/port with that id/index
AUDIO_ERR_INVALID_PARAMa parameter the API can't accept
AUDIO_ERR_INVALID_USEwrong state (start an unopened stream, ...)
AUDIO_ERR_DEVICE_BUSYthe device is in use (exclusive mode)
AUDIO_ERR_SYSTEMthe OS / library call failed
AUDIO_ERR_THREADcouldn't start the stream thread
AUDIO_ERR_NO_MEMORYallocation failed (open time only)
AUDIO_ERR_UNAVAILABLEthe backend's library/server isn't there
AUDIO_ERROR_MESSAGE_MAX