For sounds, the volume is calculated as main_volume * effects_volume * requested_volume where the requested volume is the argument to play_sound. A similar method exists for music.
Sound effects are modeled by entities with an Audio component. When they are stopped/finish the entity is killed. The music system only supported 1 song at a time, so music is stored on the AudioCenter as an Option<Audio>. This can easily be refactored to use entities, like sound effects do, in the future if needed.
Add an "Audio" page to settings with volume controls. It features a main volume slider and sliders to control music and sound effects separately.
This replaces
AudioEvents
with a newAudioCenter
that manages all audios (I would've liked to useAudioManager
but that's taken by bones).before:
after:
For sounds, the volume is calculated as
main_volume * effects_volume * requested_volume
where the requested volume is the argument toplay_sound
. A similar method exists for music.Sound effects are modeled by entities with an
Audio
component. When they are stopped/finish the entity is killed. The music system only supported 1 song at a time, so music is stored on theAudioCenter
as anOption<Audio>
. This can easily be refactored to use entities, like sound effects do, in the future if needed.