Add mute toggle to AudioStreamPlayers#120871
Open
Akosmo wants to merge 1 commit into
Open
Conversation
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.
Overview
This PR introduces mute toggles that can be accessed via an AudioStreamPlayer's inspector, and the scene tree.
While -80 dB (minimum volume in the inspector slider) is not really audible, the only way to truly mute audio is to either set linear volume to 0 (-INF dB, both unavailable to the editor) or muting in the bus. Adjusting the slider or muting in the bus are not desirable in every case, since one could just want to mute one or multiple players, and easily return to the previous levels.
2026-07-02.18-22-30.mp4
Limitations
I'm not comfortable editing code related to the Sample playback type. A little too much. I suggest someone to try adding that. This limitation is mentioned in the documentation.
The toggle is not available in the remote tree. There was an attempt, but wasn't working properly. Again, I suggest someone to try adding that eventually, since it could be useful.
Notes for reviewers
In general, despite a few of my small contributions in this repository (mostly related to audio), I'm not a very experienced programmer. This is my first time modifying the AudioServer. Would appreciate someone checking that.
I'm also not super experienced with the editor code. Most of it was copied from code related to the visibility button, but modified a bit so it'd make sense.
I've tested the changes, and things seem to work on my end.
If a new button in the scene tree really is too much, I could make an alternative PR that just adds the mute property to AudioStreamPlayers, but then the proposal wouldn't be closed.