Off sync on position "getTimelinePosition" when using "setPaused" method.

Hi HJ

It’s difficult to reason about how the timeline position is going out of sync with the game without understanding what in-sync with the game means.

I’m guessing you have some sort of timer in your game which you pause at the same time that you call FMOD.Studio.EventInstance.setPaused?

FMOD.Studio.EventInstance.setPaused is an asynchronous operation - calling setPaused posts a command to the FMOD studio update thread and returns immediately, there is then some latency before the command is processed by FMOD studio and the event instance actually changes pause state. If your game pauses and unpauses immediately while the FMOD studio event pause state changes several milliseconds later this would introduce some drift.

To avoid this issue I would suggest using the DSP clock to synchronise your game when pausing/unpausing. FMOD.Studio.EventInstance.getChannelGroup can be used to get the low level channel group belonging to the event instance and then FMOD.ChannelGroup.getDSPClock can be used to retrieve the current DSP clock value.

1 Like