Skip to content

Engine → Audio → audio_backend.h

audio_backend

Syntax

class CONJURE_API audio_backend

Derived Classes

Classes that use this as a base

Constructors

AccessSignatureDescription
publicaudio_backend();

Important

Copy constructor and assignment has been deleted.

Destructors

AccessSignatureDescription
publicvirtual ~audio_backend();

Functions

Public

enumerate_devices

[[nodiscard]] virtual core::result<std::vector<audio_device_info>> enumerate_devices() const = 0;

Playback devices this backend can open.

kind

[[nodiscard]] virtual audio_backend_kind kind() const noexcept = 0;

Which implementation this is (never AUTO).

output_format

[[nodiscard]] virtual audio_format output_format() const noexcept = 0;

The format the callback is driven at after start() (the requested one; miniaudio converts to the device's native format internally).

start

[[nodiscard]] virtual core::result<void> start(
    const backend_desc &desc) = 0;

Opens the device and starts driving desc.callback. Fails with INVALID_SETTINGS for a null callback or an unsupported sample rate, BACKEND_INIT_FAILED when the device cannot be opened and DEVICE_START_FAILED when it cannot be started; an unknown desc.deviceName is not an error (WARN, default device). A running backend is stopped first, and a failed start leaves the backend STOPPED.

state

[[nodiscard]] virtual device_state state() const noexcept = 0;

Atomic device state; readable from any thread.

stop

virtual void stop() noexcept = 0;

Stops the device; the callback is not running when this returns. Safe to call twice.

update

virtual void update(
    f32 deltaSeconds) = 0;

Main thread, once per frame. null: advance the clock and render; miniaudio: poll.