Best way to manage sounds on channels?

Hi guys

I decided to split the sounds of my game into channels cause I wanted to give the player the option to mute either the sound effects or the music. Or both.

The thing is… my game is a space shooter. So you will be listening to the same sound effect a lot (Etc.player bullet, explosions on collision etc)

I wanted to keep all of the sound effects into 1-3 channels but then I realized that if another sound is playing on the same channel the sound that is currently playing will stop absurdly.

Is there a way to properly handle this without creating a lot of channels?

Or if there isn’t, how do I handle a PEW PEW sound effect once it starts going PEWPEPWEPEW? (Shooting rapidly)

Instead of using channels to control sound volume, how about you use a variable and, before making a sound, check if that variable was true. If it is true, then make a sound.

So I saw this post Having issues playing sounds in succession or at the same time - #2 by Silver-Streak from @Silver-Streak and did something similar.

image

Based on a really quick test it seems to work, somehow.
Only that now I have no idea how to mute everything without doing something stupid like this.

Hi guys,

If someone could help me with this I would really appreciate it

You can use a variable and a repeat event to make it set the volume for the selected channels (1/2/3/4…etc)
Example:

i have 2 sounds, one playing on channel 0 and one playing on channel 1
rather than using 2 change volume actions, we use a repeat event set to 2 (since i have 2 sounds) and then we set the change volume at channel (ChannelsCounter) variable, and then we add 1 to that variable.

Basically: this event will set the volume on channel 0 and 1, to 0

in your case, you do the same, but you replace the repeat number 2 with 21 (since you have 21 channels),
and for the condition

  • If the variable SOUND_SETTINGS.SoundEffects is false
  • Trigger once
2 Likes

Thank you!

Knew @VegeTato could help :")

Not sure why but trigger once wasn’t working for my case, so I did this.

Also for some weird reason, some of my sounds are not muting completely, especially the Pew sound effect. You can hear them for a slight moment before they turn silent, so I ended up creating a variable to control their sound volume…

image

Anytime <3
Well, the trigger once is to trigger the repeat event 1 time only when called (when your variable is false), am not sure how you set up this variable, but if the default value is false, then as soon as your game starts, this event will get triggered even though the sounds didn’t play yet, so make sure to trigger this event one time, at the correct time.

Its weird why the sound effect pew volume didn’t change to 0 as you mentioned, make sure that sound channel is actually counted in the variable (21 or below), if its channel is higher than 21, then you need to adjust your repeat event number.

In the final event you’re showing, you are playing the sound effect Pew in every single frame, that will cause so many problems, add trigger once, or a condition that trigger the sound effect every time its called, not in every single frame.

also, you are playing the sound effect on the variable channel, that’s incorrect.

your play sound actions, must look like this:

  • Play the sound Pew on the channel 0, vol:100 (or the volume you want), loop: no
  • Play the sound AAA on the channel 1, vol:100 (or the volume you want), loop: no
  • Play the sound ZZZ on the channel 2, vol:100 (or the volume you want), loop: no
    and so on…
    Do not set the channel to the variable, that variable is used only in the repeat event, you play the sounds normally on normal channel numbers.
1 Like