SetTimelinePosition executes too late, is getting feedback on execution possible?

I’m trying to sync some Unity objects with fmod music. Sometimes, I have to call musicEmitter.EventInstance.setTimelinePosition(int) in order to move the timeline to correct time. But this function doesn’t execute instantly (checked with getTimelinePosition). For one of my shorter music, it’s 3 frames late and for one longer music track it’s 8 frames late. By the time it actually jumps to desired position, my Unity objects have already moved away.

So, I either have to calculate the time it takes to execute this function, or I need to make my Unity objects wait for its execution.

For both scenarios, I need a feedback on when the setTimelinePosition really moves the timeline. Is there such a way?

PS I can’t use getTimelinePosition to check when it jumped to desired time because it’s not that precise, it sometimes happen that it jumps to the desired pos and plays a little bit before getTimelinePosition gets the time, so it returns (desiredPos + thatLittleBit).

Thanks

Hi John,

I"m not able to replicate your issue. When using setTimelinePosition it seems to happen pretty instantaneously. Are you able to post some sample code or a video of what’s happening?

Thanks,
Richard

Hi Richard,

Thank you for helping out. Are you working at Fmod? I’ve made a Unity project with latency test that I can send to you. You just press play and watch the latency log printed out in the console. But I’d have to send the song as well because it might have to do with the complexity of the Fmod project. Can we continue communicating privately via e-mail? I shouldn’t share this music publicly.

PS, I’m using FMOD studio and plugin version 1.10.08 and Unity 2018.2.1f1

Thanks

Richard has helped me solve this issue via e-mail, so I’ll post the information here for anyone having the same problem.

The issue was that some of the assets in Fmod project were set to “streaming” which made Unity mark the whole event to Stream:true (in event properties of event emitter).

Streaming uses less memory but can introduce some latency. After setting the event not to stream, latency of execution of SetTimelinePosition function is almost gone and totally acceptable.

Non-streamed music does use more memory though, which can be reduced by choosing an appropriate quality percent of vorbis compression.