class Raudio::AudioDevice

Overview

Audio device management (singleton pattern) Handles initialization and cleanup of the audio device

Note: AudioDevice operations are thread-safe, but audio playback operations (Sound, Music, AudioStream) should be performed from a single dedicated thread.

Defined in:

raudio/audio_device.cr

Class Method Summary

Class Method Detail

def self.close : Nil #

Close the audio device This is automatically called at program exit if init was called Thread-safe: Can be safely called from any thread


[View source]
def self.init : Nil #

Initialize the audio device This is automatically called when using the block form Thread-safe: Can be safely called from any thread


[View source]
def self.master_volume : Float32 #

Get master volume (listener) Thread-safe: Can be safely called from any thread


[View source]
def self.master_volume=(volume : Float32) : Nil #

Set master volume (listener) Thread-safe: Can be safely called from any thread


[View source]
def self.open(&) #

Open audio device with automatic cleanup This is the recommended way to use the audio device Thread-safe: Can be safely called from any thread

Example:

AudioDevice.open do
  # Use audio here
end

[View source]
def self.ready? : Bool #

Check if audio device is ready Thread-safe: Can be safely called from any thread


[View source]