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