class

MinAudio::Engine

Inherits Reference < Object

Constructors

new(backends : Array(Int32) | Nil = nil)

backends pins the backend list (LibMinAudio::BACKEND_* — e.g. [BACKEND_OPENSL] to bypass AAudio on a vendor build that refuses it). Nil = miniaudio's default priority order.

Source

Instance methods

channels

Output channels / sample rate of the opened device.

Source
close

Uninit every tracked sound and the engine itself. Idempotent. The pinned context (if any) is freed AFTER the engine — miniaudio keeps the pointer.

Source
closed?
Source
finalize
Source
group(parent : SoundGroup | Nil = nil) : SoundGroup

A named volume/stop bus (ma_sound_group). Sounds pass group: at creation; the master group is used when nil.

Source
pause

Temporarily silence everything (device-level; sounds keep state).

Source
play(path : String, *, volume : Float32 | Nil = nil, loop : Bool = false, stream : Bool = false, group : SoundGroup | Nil = nil) : Sound

Prepare and immediately start a sound. loop keeps it looping.

Source
play_file(path : String, group : SoundGroup | Nil = nil) : Nil

Fire-and-forget playback: miniaudio loads, plays and reaps the sound itself — no Sound object comes back. Ideal for UI clicks.

Source
resume
Source
sample_rate
Source
sound(path : String, *, stream : Bool = false, async : Bool = false, group : SoundGroup | Nil = nil) : Sound

Prepare a sound without starting it (Sound#start when wanted).

Source
sound(buffer : AudioBuffer, *, group : SoundGroup | Nil = nil) : Sound

Prepare a sound from a decoded in-memory AudioBuffer (see AudioBuffer) without starting it. The buffer must outlive the sound — the Sound keeps it referenced, and Engine#close closes tracked sounds before the buffer is expected to go.

Source
stop_all

Stop (not uninit) every tracked sound.

Source
to_unsafe
Source
volume

Master volume applied to every sound (also see Sound#volume=).

Source
volume=(volume : Float32) : Float32
Source