How do I turn a group of audio off?

Get help using Construct 2

Post » Sat Apr 15, 2017 8:22 pm

I'm having problems with turning a group of audios off.

The project i'm working on has SoundFX and Music, and in its settings menu you can turn each one of them off.
The problem is, I don't have a way to group sounds like in a family or using multiple tags for it.

Which should be an easy way to turn all my SoundFX off when the same is put off in the settings menu? Is it the only way choosing each one of them to my event? :?:
B
11
S
3
G
3
Posts: 16
Reputation: 1,810

Post » Sun Apr 16, 2017 2:31 am

From my understanding of the current limitations of C2 audio plugin you can't control them via group and you can't have multiple "tags".

So you will need to tag all music event actions with their own separate tag (like "music"), and all sound effects with a different tag (like "effects").

You might be able to get creative and call them via functions that you kept in a separate group that you could toggle off and on.. if the function couldn't run the effect/music sound couldn't play.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
65
S
17
G
8
Posts: 636
Reputation: 9,333

Post » Mon Apr 17, 2017 2:01 am

I see... I'll try to create the functions and see how it goes.

Thanks for your help! :-)
B
11
S
3
G
3
Posts: 16
Reputation: 1,810

Post » Mon Apr 17, 2017 1:47 pm

You could get around it by creating a 2-D array and adding the names of the tags for a group of sounds to a column/row - this would allow you to place a sound in multiple groups.
When you want to affect all sounds in a group you could then run a loop on that group, pointing the tag field in the relevant audio action.

e.g.
you have sounds tagged "sfx_A", "sfx_B", "sfx_C", "sfx_D"

array_soundGroups has three groups of 3 sounds:

0: ("A", "B", "C"),
1: ("B", "C", "D"),
2: ("D", "B", "A"),

To turn off group 2:
for "i"=0 to array_soundGroups.Height-1)
> stop sound tag "sfx_"&array_soundGroups@(2,loopindex("i"))
B
16
S
7
G
3
Posts: 396
Reputation: 3,700

Post » Mon Apr 17, 2017 9:29 pm

You could get around it by creating a 2-D array and adding the names of the tags for a group of sounds to a column/row - this would allow you to place a sound in multiple groups.
When you want to affect all sounds in a group you could then run a loop on that group, pointing the tag field in the relevant audio action.

e.g.
you have sounds tagged "sfx_A", "sfx_B", "sfx_C", "sfx_D"

array_soundGroups has three groups of 3 sounds:

0: ("A", "B", "C"),
1: ("B", "C", "D"),
2: ("D", "B", "A"),

To turn off group 2:
for "i"=0 to array_soundGroups.Height-1)
> stop sound tag "sfx_"&array_soundGroups@(2,loopindex("i"))


Pure witchcraft!

Yes that is a good way to do it as well. I believe C3 fixes some of these audio issues.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
65
S
17
G
8
Posts: 636
Reputation: 9,333


Return to How do I....?

Who is online

Users browsing this forum: el3um4s and 8 guests