Looking plugin or behavior to access audio tags.

0 favourites
  • 11 posts
From the Asset Store
Antisuspend Plugin for Construct 3 prevents the runtime from getting suspended.
  • Hi, is there any plugin or audio behavior that allows access to all tags of the sounds being played at that time ?.

    Suppose that X point in the game, I need to know the labels of the sounds in reproduction at that time, is there anything that allows this ?.

    I have a sound that always being played in loop mode, sometimes other sounds are also played and then several sounds are heard at once.

    Ok, I need to know when that sound is playing without any other sound more.

    I mean, i need to know when the sound is unique sound playing without all others sounds.

    So I think a plugin or a behavior that allows access to the labels of the sounds being played at that time could help this issue.

  • Taken from the manual: https://www.scirra.com/manual/109/audio

    Audio tags

    Some actions affect audio parameters such as the volume for sounds which are already playing. However there can often be many sounds playing at once in a game. In order to identify which sounds you want to affect, sounds are played with an associated tag. This is any string that identifies the sound. For example, the player's weapon sound effect could be played with the tag "PlayerWeapon" and an enemy's weapon with the tag "EnemyWeapon". Then, the tag can be used in the Set Volume action to specify which sound to set the volume for. Tags are case insensitive.

    Multiple sounds can also play at once using the same tag. In this case actions like Set Volume affect all the sounds playing with that tag.

    A tag which is an empty string ("") has a special meaning: it refers only to the last sound played with the Play action. This is convenient for playing a sound and immediately setting its volume and other parameters

    AUDIO CONDITION:

    Is tag playing

    True if any audio with a given tag is currently playing.

  • Taken from the manual: https://www.scirra.com/manual/109/audio

    Audio tags

    Some actions affect audio parameters such as the volume for sounds which are already playing. However there can often be many sounds playing at once in a game. In order to identify which sounds you want to affect, sounds are played with an associated tag. This is any string that identifies the sound. For example, the player's weapon sound effect could be played with the tag "PlayerWeapon" and an enemy's weapon with the tag "EnemyWeapon". Then, the tag can be used in the Set Volume action to specify which sound to set the volume for. Tags are case insensitive.

    Multiple sounds can also play at once using the same tag. In this case actions like Set Volume affect all the sounds playing with that tag.

    A tag which is an empty string ("") has a special meaning: it refers only to the last sound played with the Play action. This is convenient for playing a sound and immediately setting its volume and other parameters

    AUDIO CONDITION:

    Is tag playing

    True if any audio with a given tag is currently playing.

    I read the manual, how do you think could solve my problem with that ?.

  • You want to know which audio files are playing.. correct?

    So when adding a "play audio" event you can set a tag for that specific audio file.

    Then you can find out if that audio tag is playing using the condition: audio "tag" is playing.

    Imagine using 1 tag for all audio files.

    Than you can access all these audio files using that specific tag.

    Set their volume.

    Make stop playing.

    Setting effects etc.

    Example.

    2 audio files playing use tag "gunshot".

    1 audio file playing uses tag "bomb".

    You can check audio: is "gunshot" playing-->set playback rate to 1.2

    Etc.

    Does this answer your question?

  • You want to know which audio files are playing.. correct?

    So when adding a "play audio" event you can set a tag for that specific audio file.

    Then you can find out if that audio tag is playing using the condition: audio "tag" is playing.

    Imagine using 1 tag for all audio files.

    Than you can access all these audio files using that specific tag.

    Set their volume.

    Make stop playing.

    Setting effects etc.

    Example.

    2 audio files playing use tag "gunshot".

    1 audio file playing uses tag "bomb".

    You can check audio: is "gunshot" playing-->set playback rate to 1.2

    Etc.

    Does this answer your question?

    I understand but my problem is not that.

    My sounds are played with a different label each, the name of the label is its file name.

    File -> shotPlayer.ogg

    tag -> "shotPlayer"

    File -> enemyKilled.ogg

    tag -> "enemyKilled"

    etc...

    I have a sound played in a loop throughout the game.

    I need to know when you're playing that sound only and no more.

    For what?.

    When other sounds playing, then I must turn down the volume of the sound played in loop.

    When no sound except the sound playing loop, then I must increase its volume.

  • Ah thats should be simple.

    Make a variable, call it "allsounds".

    Then add to each event where you play a sound other than loop.

    On play: set variable to 1.

    Else: set variable to 0.

    Put the play "loop" event all the way at the bottom of the event sheet.

    Let it check: If variable allsounds = 1

    Set volume to low.

    If variable allsounds = 0

    Set volume to high.

    Because the event sheet works from top to bottom you can do it this way.

    All sounds are checked playing and if they dont play.

    Then for each sound the "Else" event is triggered.

    So it will be set to either 1 or 0.

    Reaching the bottom of your event list then it checks if that variable is 0 or 1.

    I hope i explained it simple.

  • Ah thats should be simple.

    Make a variable, call it "allsounds".

    Then add to each event where you play a sound other than loop.

    On play: set variable to 1.

    Else: set variable to 0.

    Put the play "loop" event all the way at the bottom of the event sheet.

    Let it check: If variable allsounds = 1

    Set volume to low.

    If variable allsounds = 0

    Set volume to high.

    Because the event sheet works from top to bottom you can do it this way.

    All sounds are checked playing and if they dont play.

    Then for each sound the "Else" event is triggered.

    So it will be set to either 1 or 0.

    Reaching the bottom of your event list then it checks if that variable is 0 or 1.

    I hope i explained it simple.

    I have doubts about this system.

    Could you make an example in this capx ?.

    Maybe this that helps me understand if you system is valid for me.

    https://dl.dropboxusercontent.com/u/60803633/testSound.capx

    How to lower the volume of sound "bucleSound" when another sound is ringing ?.

    Then, when there is no other sound reproduction, you must turn up the volume to "bucleSound".

  • I will take a look at it after work tonight.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So have you checked it?

  • So have you checked it?

    Hi, I'm testing.

    The first thing I saw in the system that you use is that you need to know what labels sounds.

    I have many sounds with different labels and can not do such a condition

    if "label1" is playing

    or

    "Label2" is playing

    or

    etc...

    "Label25" is playing

    ...

    So I ask a plugin that allows to know how they are called labels of the sounds are playing.

    I have to check which system serves me.

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