How to get SoundCue duration when using several waves?

I can’t find a way to get the duration of an SoundCue that contains several SoundNodeWave with different durations, to play random. Using “soundcue.getcueduration()” always returns the same value, the duration of one of the soundnodewaves (I think the first), but not the current playing. So the duration is incorrect the most of times.

There are any way to get the soundnodewave in play for that soundcue? For example:

myAudioComponent.play();

myAudioComponent.SoundCue.SOMEFUNCTIONTOGETPLAYEDWAVE.duration;

I’m not sure if there’s a way to get duration. but maybe this delegate in AudioComponent will help in your situation?


delegate OnAudioFinished(AudioComponent AC);

haven’t tried it but what about:


myAudioComponent.PlaybackTime

it’s the only one I found that could potentially help

It’s the time that passed since SoundCue have started to play, if I’m not mistaken.

Yes, Playbacktime is the time from start.

I use the delegate with SoundCues to stop animations when the pawn finished talking.

But in this case I need to know the duration to use in a function that makes two pawns to talk between them. Pawn 1 says something, when finish, Pawn2 reply, and go to Pawn1 again, until the conversation ends. I use a timer with the sound duration to play the next sound, and works perfectly when I use soundnodewaves, but when using soundcues, the timer takes an incorrect value.

The only solution I know is not using timers when the sound is a SoundCue. Using instead some variables in the pawns, and in the delegate function when the current sound finishes, start the next phrase. But I wanted to know if there are any way to know the duration (or the soundnodewave played), that would be a best way to do the thing.

Thanks to all!

You could do it via a slightly cumbersome method whereby from script you run a seq event to kismet. From the kismet event run a play sound node (maybe pass a flag to indicate the sound you want to play) and from the play sound node which has the a finished link have a seq act which passes control back to script.

No timers involved. You could even control the whole conversation from kismet if you wanted.

An unique sound node (wav) ? Or a soundcue with several soundnodewav’s with a random node?

This is an example of what I do with a sound cue, it would just need a seq act added to the finished from the play sound node to pass control back to script. I created the play event (pass info as to which sound to play and to which player) and used the default play sound node.

The sound cues I use have a mix of single sound wavs to some with a random node inside the cue that can play different sound wavs. I just don’t need to use the finish from the kismet Play Sound.

I’ve no idea as to whether the finish from the play sound works for the different length wav files inside a cue (when a random node is used in the cue), do a quick test as it doesn’t take long to setup.

b6f615c901c8a5882d54512e2c3ae6ad0d85c198.jpeg

Was curious so did a quick test with play sound node and a cue with a random node and various length wavs. Seems the finish activates based on the time of the longest wav.

If you know the length of each wav then you can use the before end time to subtract from the longest wav time but I guess if you had an array of all wavs running times you could do all of that in script and a timer …

Then is like using your own custom cue instead the engine soundcue… I think that the better solution is to use the delegate and some flags to play the next dialog. Thanks to all.