Metasound Starting and stopping instantly


This is my Metasound graph for my gun sound.
I call the start trigger when left click is pressed and the stop trigger when left click is released however, if I press left click really fast so that the start and stop triggers are called on the same frame no sound is played. I want the sound to play but also not play anymore after that frame. How can I fix this? This is for a gun that fire 10 times per second so it doesnt play the sound quite often when spamming left click but I cannot have this in the final game. Are there any easy ways around this?

Thank you!

The code that handles firing logic should be calling the execution of the sound. Not an Input. Each time the weapon actually fires you execute the playing of the sound. This way you aren’t playing audio when the weapon can’t fire (out of ammo etc).

For rapid firing I have the audio in two pieces. Frontend and backend (tail). During fast repetition the tail is never played, only the frontend. The last shot gets the tail applied.


This is what I actually do. StartFire and StopFire are called when left click is pressed and released. It then checks if it can fire and if it can, it starts the audio. The problem is when I call StartFire then StopFire really fast, it instantly stops the audio as it starts.

This is the audio graph that just repeats a sound 10 times per second to copy the guns fire rate. I tried just delaying the stop trigger so it stops the audio after one shot but then two shots are fired if held too long.

Is there anything you can see I should do please?

Because your Releasing the trigger calling for the Audio to stop.

Don’t loop your audio for automatic shooting. Either use your timer or have the code that actually does firing call the sound.

example…
My inputs are in the character class. It calls an event in the weapon class.

Weapon class determines firing mode and calls a specific function/event to execute.

Said function itself handles everything for firing including the FX.

The code doesn’t rely on the input being pressed. If it fires a shot it finishes the chain of events.