Download

Sound Cue - Get Playing Wave Name

Hi, I’ve got a slight problem!

I’m working on my project and a free project for the community in which they have a Radio system which they can use to their heart’s desire.

I’ve got all the Sound Cues set up, where it’ll randomly cycle through songs and I can turn it on and off whenever I please, all that good stuff.

However, there’s a feature that’s missing that really hampers what I’m trying to do - Get Playing Wave Name!

It should be really simple to implement, maybe a Blueprint node which you can call from a AudioComponent with SoundCue attached, where it will simply tell you what the WaveName is that is currently playing - This would allow people to make the Blueprint do specific things depending on which sound / song is playing or have a UMG which tells them the song name.

At the moment, I don’t believe it’s possible but if someone could make this a reality - This would make me a happy man and hopefully would make the lives of the people who’ll download the eventual free project happy too!

It’s not game specific either - You could use it in car games, open-world games .etc Or you could be even more creative and do things like “If player solves X puzzle while Y song is playing = Secret Bonus” .etc

Please let me know if I’ve missed something and this is already possible, if it isn’t - Please please please can you find the time to add something like this in?

Thanks! :smiley:

There are 2 key problems with this request a small one and a big one.

Minor - SoundCues can easily generate more than 1 wave file being played simultaneously (or even 2 different variations of the same one), so the return function you want would at the very least need to return a list of active wave instances.

However, the major problem is that while today we could probably do this without great difficulty, once the audio processing (and thus sound cue evaluation) is moved to its own thread we wouldn’t be able to simply return that information because it would require making a synchronous call to another thread to find out what the current state is.

I would suggest that if you want to achieve this same kind of system that you would be better off implementing the randomization and whatnot in blueprints and just change the playing sounds in your audio component. Since you are making the choices in blueprints you’ll know exactly what you sent over to it and have the name of the wave.

Thanks for getting back to me with this.

I’ll have to go the long-way round then :stuck_out_tongue: - But if I do it via Blueprints, is there a way to tell when a song has finished playing and to play the next one? I assume a switch on Random INT > The Sound > Finished? Set Bool to Reset?

Edit: I realized I could do IsPlaying (Thanks Fen!), I’ll do it that way then!

AudioComponents have an OnAudioFinished callback you can tie in to. So at a very basic level you’re looking at something vaguely like.

Create an AudioComponent
Create an OnAudioFinished event for it
Connect a SetSound with the next sound you want to play
Connect a Play to kick it off again