Audio Component. Event On Audio Finished does not work when the track is finished.

Good afternoon, I have the following problem. I want to add BGM_BattleTheme, which consists of 2 parts: Opening and Main Part.
Opening should be played once per battle and Main Part is looped.

I did through Audio Component, and when Opening finished playing, for some reason Event On Audio Finished, which should start Main Part, is not running. What could be the problem?

Hi, @Dzhajron !

I hope you’re doing well.

Wanted to share some ideas worth trying, as well as some recommendations when dealing with sample-accurate audio pieces (which you will need in order to seamlessly concatenate/stitch together audio clips).

My first recommendation would be to create this system inside a MetaSounds object, as the new Quartz audio engine offers sample-accurate audio processing. Running this process else will likely run into delays/latency between the game thread and the audio render threads, resulting in potential gaps between concatenated clips.

Perhaps consider creating a MetaSounds object with two inputs; one for your BGM’s “Intro” and one for the BGM’s “Main Loop”. Then, connect the “Intro” wave player’ OnFinished event to the “Main Loop” wave player’s Play input:

Please let me know if that helps! Can explore other solutions if you’re working on an older version of UE.

Thank you!
Eric

Yes, that’s the way to go, only one thing about it - if you want a seamless stitch you should trigger your main loop from the On Nearly Finished pin.

Also, if it wasn’t clear, on the blueprint side you’ll only need to Spawn Sound 2D with that metasound, and pass in the two wave assets to play, with Audio Parameter Controller Interface as target.

Good luck !