feat: Allow volume control of Music & Sound with property#1311
Open
DeathPhoenix22 wants to merge 1 commit intoAlmasB:devfrom
Open
feat: Allow volume control of Music & Sound with property#1311DeathPhoenix22 wants to merge 1 commit intoAlmasB:devfrom
DeathPhoenix22 wants to merge 1 commit intoAlmasB:devfrom
Conversation
DeathPhoenix22
commented
Oct 24, 2023
|
|
||
| private val loader = DesktopAndMobileAudioLoader() | ||
|
|
||
| override fun onMainLoopStarting() { |
Contributor
Author
There was a problem hiding this comment.
Automatically handled by the Audio with Property change listeners
DeathPhoenix22
commented
Oct 24, 2023
| if (!activeSounds.containsByIdentity(sound)) | ||
| activeSounds.add(sound) | ||
|
|
||
| sound.audio.setVolume(soundVolume.value) |
Contributor
Author
There was a problem hiding this comment.
No need anymore, the global volumes are automatically mixed with the Media configured sound
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi,
Issue Link: #1310
Here's an implementation that allow custom Volume configuration of all Sounds & Musics. I've placed the "Master / Global" volume property of the AudioType inside them. This felt pretty natural since the "expert" (GRAPS) of that information is the AudioType itself. This also mean that we could really easily add a new AudioType without much efforts and that new type would automatically mix itself against the Global and the current Audio.
@AlmasB NOTE: I took the initiative to revert the changes made in #1187. Granting access to the internal audio is causing a bug related to volume adjustments in the settings. Whenever a player was adjusting his Global volume, all custom changes made on the audio (getAudio()) was automatically reverted. With this implementation, the conjunction of the 2 values are always kept (via the mix() method)
Example:
Note that changing the Global Music volume will also automatically impact all Music:
I've tested it on my own game and I needed it!
I hope you like it! :)