class
Raudio::AudioDevice
- Raudio::AudioDevice
- Reference
- Object
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.crClass Method Summary
-
.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
-
.init : Nil
Initialize the audio device This is automatically called when using the block form Thread-safe: Can be safely called from any thread
-
.master_volume : Float32
Get master volume (listener) Thread-safe: Can be safely called from any thread
-
.master_volume=(volume : Float32) : Nil
Set master volume (listener) Thread-safe: Can be safely called from any thread
-
.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
-
.ready? : Bool
Check if audio device is ready Thread-safe: Can be safely called from any thread
Class Method Detail
Close the audio device This is automatically called at program exit if init was called Thread-safe: Can be safely called from any thread
Initialize the audio device This is automatically called when using the block form Thread-safe: Can be safely called from any thread
Get master volume (listener) Thread-safe: Can be safely called from any thread
Set master volume (listener) Thread-safe: Can be safely called from any thread
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
Check if audio device is ready Thread-safe: Can be safely called from any thread