Audio
Methods
@classmethod
preload()
# Preload all sounds. To be called once.
@classmethod
play(sound: str) -> pyglet.media.Player
# Play a sound.
Keyword Arguments
sound: str
-- The name of the sound to play.
Returns: The sound stream player.
@classmethod
play_random(sound_list: list) -> pyglet.media.Player
# Play a random sound from a list.
Keyword Arguments
sound_list: list
-- The list of sounds to play from.
Returns: The sound stream player.
@classmethod
stop(sound: Union[str, pyglet.media.Player])
# Stop a currently playing sound or sound stream player.
Keyword Arguments
sound: str
-- The name of the sound to stop.
sound: pyglet.media.Player
-- The sound stream player to stop.
@classmethod
on_update(_delta_time: float)
# Update. Called on every frame.
Keyword Arguments
_delta_time: float
-- The time since the last update.
@classmethod
increase_volume()
# Increment the master volume.
@classmethod
decrease_volume()
# Decrement the master volume.
@classmethod
stop_all_sounds():
# Stops all currently playing sound streams.
@classmethod
mute():
# Mute audio.
@classmethod
unmute():
# Unmute audio.
@classmethod
toggle_mute():
# Toggle mute audio.