How to play multiple sounds at once from one Audio Component?


I have modified the First person controller class to have a jump and sprint function, and it is working well in regards to functionality.

When the player lands there is a sound effect played, likewise when the player begins to sprint.

The issue is whenever the landing sound is played, it is stopped halfway through and the sprint sound begins to play.

How do I allow the landing sound to finish playing while the sprint sound begins to play?

Is this even an option with the audio component attached to the player?
How do I achieve this?

EDIT: I forgot the code like a goober

	if (SprintSound != NULL && bHasPlayedSprintSound == false)
		bHasPlayedSprintSound = true;

I also play my other sounds using the SetSound() and Play() functions on the component.
Thank you!

1 Like

Just make 2 audio components, and assign sprint to one and land to the other. Attach both audio components to your actor.

Yes, absolutely fine from a performance perspective.

It’s working great, thank you for helping!

Sounds good will accept this as soon as I try it.
Is this okay to do performance wise?

Think of audio components as a handle to a single playing sound. It allows you to change a sound’s position, it’s volume, it’s pitch, etc, from BP.

In truth it’s actually a handle to an “active sound”, where an active sound may have multiple sound wave instances if the active sound has a USoundBase type that is a sound cue, and that sound cue is playing multiple sounds at once (through a mixer node, etc).

But the point is generally true and you should always think of audio components as a handle to a single sound.

1 Like