I’m using FMOD Studio with banks and as a raw file in my project, and I’ve encountered an issue when pausing and resuming audio. I load my audio as a bank event (i.e., an FMOD Studio Event Instance) and use the setPaused(true) method to pause the audio. However, while the audio is paused, the event’s internal timeline continues advancing. This means that when I unpause the event, the playback position jumps ahead (e.g., from 100 ms to 150 ms), even though the audio was supposed to be paused.
When i use raw file (like wav or ogg) everything is fine.
Audio.cpp
unsigned int Audio::GetSongPosition(const std::string& songName)
{
unsigned int pos;
if (auto* channel = ResourceManager::GetChannel(songName))
ERRCHECK(channel->getPosition(&pos, FMOD_TIMEUNIT_MS));
else if (auto* instance = ResourceManager::GetEventInstance(songName))
{
int tmpPos;
ERRCHECK(instance->getTimelinePosition(&tmpPos));
pos = static_cast<unsigned int>(tmpPos);
}
else
{
std::cout << "There is no: " << songName << std::endl;
return 0;
}
return pos;
}
This will help to reduce the jump noticed when resuming the event. Another option may be setting the event macro Priority to Highest (FMOD Studio | Event Macros Drawer - Priority) which can also reduce some drift caused by the virtualization system. I will note this has been solved in 2.03.