Adding more options for volume
Discussed in https://github.com/AlmasB/FXGL/discussions/1180
Originally posted by nicymike June 10, 2022 Hey!
-
What do you think about adding a new setting to audio for master volume. Many games have three (or sometimes more) volume sliders: master, music, sound. The volume for playing audio is then calculated by: soundVolumeForPlay = master * sound musicVolumeForPlay = master * music
-
What do you think about adding the possibility to play a sound with a different volume eg. adding a new optional parameter to the methods for playing a sound or music. In my game I have certain sounds for ambience which should be played with lower volume. What I am currently doing with FXGL is: 1. Lower sound volume, 2. Play sound, 3. Raise sound volume.
Relevant extract:
That's a good point. It seems the implementation is hidden from public API. This might have been necessary to hide cross-platform support (particularly on mobile), but I don't see why we couldn't open access to getAudio(). From the list you will note the method is actually there, just hidden in $fxgl_core. I'm happy to turn this into an issue, so we can track it and fix it eventually.