How to mute all sounds except Background Music?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By boxxy26

So in short I have a scene with background music and five buttons. Each time a button is pressed, a looping sound plays on top of the background music (one different looping sound per button).

How would I go about making it so each time a button is pressed, the looping sound of the previous one is muted and the new one is unmuted (while the background music keeps playing as normal)I tried doing something with different buses but I can’t quite figure it out. I believe the answer is pretty simple but I can’t quite grasp it. Thanks in advance.

:bust_in_silhouette: Reply From: Pomelo

A solution would be to have a node for each sfx and make some checks like, if Audio.playing() == true, then Audio.stop(), for all the nodes that you dont want to play. another aproach would be to have only one node for sfx, and load and play a sound when you want to, like = sound_you_want and then

Thanks but is there a way to mute the audio instead of stopping it? (so it keeps playing even if its muted)

boxxy26 | 2021-10-20 23:08

:bust_in_silhouette: Reply From: drumstickz64

Godot has audio buses (which are like audio channels). so you can just assign the background music to a bus and the game sounds to another, and just mute the game sounds bus.

Godot has a documentation page for audio buses