Sounds Overlapping

Get help using Construct 2

Post » Thu Apr 26, 2012 5:17 pm

How can I limit instances of the same sound from playing? I have a weapon that can overlap multiple enemies each causing them to emit a "hurt" sound. What I don't want is to trigger them all at the same time necessarily, which can start clipping and distort. I want to be able to say only play one of a certain instance of sound while one is still playing.


Inversely, is there support to stop a currently playing sound if it is asked to play again, effectively interrupting and replacing the original one with the new instance?
B
11
S
1
Posts: 44
Reputation: 1,095

Post » Sat Apr 28, 2012 8:16 am

I believe you can do that by using the sound's "Stop" action. Have you tried that?

You could simply stop the sound every time the action occurs, then play it. So you'd have a 2-part action.

If x condition...
Stop "sound"
Play "sound"

Something like that perhaps?
B
126
S
7
G
4
Posts: 185
Reputation: 7,233

Post » Sun Apr 29, 2012 12:24 pm

Thanks for the try. My first stroke of genius was to add a counter. For every of this instance playing add one to counter. If counter is above 1 then stop sound. Sounded logical. But it stops all sounds, not just the offending one.
The same would apply to your idea. Once you throw in that stop sound, it stops all certain sounds. Not just one, or the most recent one.

I think my ultimate solution lies in some of the timeline and cooldown plugins for C2 that I'm checking out now. Essentially adding a cooldown to a sound so it can't play until the cooldown ends. Still a bit hacky.

I'm an audio engineer by trade for the video game industry and I'm kinda spoiled on audio middleware like wwise and fmod that allow you to create a basic rule and priority system for audio.

I'll keep trying stuff out though, thanks!

B
11
S
1
Posts: 44
Reputation: 1,095

Post » Sun Apr 29, 2012 2:02 pm

I may have misunderstood this a bit, but it sounds like you just need to add a tag to your particular sound. Then you'll be able to address just that particular sound by referencing that tag.

Have you tried that?

Basically, you add a tag, like "gun". Then when you use the Stop action, you enter "gun" for the tag of the sound to stop.
B
126
S
7
G
4
Posts: 185
Reputation: 7,233

Post » Sun Apr 29, 2012 4:30 pm

yeah, tagging them helps it a bit so they don't stack now. Thanks for that. But I don't want the new one to replace the old, I want the old one to play out before a new one will play (or at least be audible).

Closer now!
B
11
S
1
Posts: 44
Reputation: 1,095

Post » Sun Apr 29, 2012 6:31 pm

@TPorter64, not sure but are you sure you're not just missing a "Trigger once" condition? See this tutorial.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Mon Apr 30, 2012 3:54 am

For this instance, no. I'm not playing it on tick or any other timing variable so it's not that the item is spamming on one ammo+enemy overlap. It's that my weapon is a constant stream (not particles) and can cover multiple enemies. And each one of those enemies that is affected by the stream is told to play a pain sound. What I want to be able to do is say, "ok, 7 enemies are in the stream, but I want to cap the pain sound at only 2 or 3 possible globally at one time".

I'm still experimenting and feel I'm getting close, but it's never quite right...yet.
B
11
S
1
Posts: 44
Reputation: 1,095


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 0 guests