Is there a way, using C++, to play a sound with a given delay or at a specific time?
There is no built-in logic in the engine to play delayed/scheduled sound but the UE4 has the timers, use them:
There is an additional parameter to AudioComponent->Play(), which is the delay to play the audio with.
Thank you, I will take a look at timers.
Is the parameter the delay or the playback time? The documentation is not clear and your answer to another of my questions seems to imply that it is the playback time. Maybe I misunderstood that answer.
It’s the “start time”, which simply means “delay before playing”.
Or it will shift sound and play from the certain moment - without delay, it is difference and the docs isn’t very precisely with this matter.
There is a pitfall when it comes to timing audio play to exact time, if the audio asset is compressed it will result in a few ms delay between the actual play command and sound coming out of the speakers.
I ran some tests and the StartTime parameter changes the playback time. It does not introduce a delay.
Yea, I expected this to be a concurrency setting but it isn’t. Would be extremely helpful to have, and I would think it’s a common issue.
Unless it’s been added somewhere else since this post and I’m not aware of it.