mini_arcade_native_backend.ports.audio¶
Audio port for the Mini Arcade native backend.
Classes¶
Audio port for the Mini Arcade native backend. |
Module Contents¶
- class mini_arcade_native_backend.ports.audio.AudioPort(native_audio: mini_arcade_native_backend._native.Audio)¶
Audio port for the Mini Arcade native backend.
- Parameters:
native_audio (native.Audio) – The native audio module.
- init(frequency: int = 44100, channels: int = 2, chunk_size: int = 2048)¶
Initialize the audio subsystem.
- Parameters:
frequency (int) – The audio frequency (default: 44100).
channels (int) – The number of audio channels (default: 2).
chunk_size (int) – The audio chunk size (default: 2048).
- shutdown()¶
Shutdown the audio subsystem.
- load_sound(sound_id: str, path: str)¶
Load a sound file.
- Parameters:
sound_id (str) – The identifier for the sound.
path (str) – The path to the sound file.
- Raises:
ValueError – If sound_id is empty.
- play_sound(sound_id: str, loops: int = 0)¶
Play a loaded sound.
- Parameters:
sound_id (str) – The identifier for the sound.
loops (int) – The number of times to loop the sound (default: 0).
- set_master_volume(volume: int)¶
Set the master volume.
- Parameters:
volume (int) – The master volume (0-100).
- set_sound_volume(sound_id: str, volume: int)¶
Set the volume for a specific sound.
- Parameters:
sound_id (str) – The identifier for the sound.
volume (int) – The volume for the sound (0-100).
- stop_all()¶
Stop all currently playing sounds.