How do I turn a group of audio off?

  • 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?

  • 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.

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

    Thanks for your help!

  • 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"))

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • [quote:2p1j94s4]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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)