Hello,
After some new sounds added, our game has a significant frame drop. After some investigation, I have found that setting event instance parameters every frame will cause frame time increase dramatically when multiple instances of the same event are present.
The frame time increase in my case is almost 30ms in FMOD Studio, and jumping up and down; this is too laggy even for my strategy game.
I have made 2 small programs to demonstrate this, one using FMOD EX and one FMOD Studio. They just init and prepare 20 instances of same looping event, enter the main loop. Every frame it sets parameters and sleeps a little. The time measure showed what I just said. On my computer the Studio is around [17000us to 29000us]. And EX takes no time.
I am setting them every frame because they change based on game state.
FMOD Studio Version:
do
{
.......
FMODERRCHK( system->update() );
for (int i=0;i<ARRAYSIZE(eventInstance);i++)
{
eventInstance[i]->setParameterValueByIndex(0, 0.5f);
eventInstance[i]->setParameterValueByIndex(1, 0.0f);
FMOD_3D_ATTRIBUTES attributes = { {0} };
attributes.forward.z = 1.0f;
attributes.up.y = 1.0f;
eventInstance[i]->set3DAttributes(&attributes);
}
.......
.......
printf("FMOD Studio\n");
printf("Frame time: %lld us\n", prevMaxFrameTime);
Sleep(1);
} while (!GetAsyncKeyState(VK_ESCAPE));
FMOD EX Version:
do
{
.......
for (int i=0;i<ARRAYSIZE(testSubject);i++)
{
FMOD_VECTOR pos = {0,0,0};
FMOD_VECTOR vel = {0,0,0};
FMOD_VECTOR ori = {0,0,1};
testSubject[i]->set3DAttributes(&pos, &vel, &ori);
param1[i]->setValue(0.5f);
param2[i]->setValue(0.0f);
}
ERRCHECK(result = eventsystem->update());
.......
printf("FMOD EX\n");
printf("Frame time: %lld us\n", prevMaxFrameTime);
Sleep(1);
} while (!GetAsyncKeyState(VK_ESCAPE));
If you comment out any setXXX in FMOD Studio version, it will be fine.
The events are basically the same. In fact, even if I use an empty event with no sound, the FMOD Studio version still lags. Am I missing something here?
This really makes me want to go back to the good old FMOD EX.
Visual Studio Project download link: https://dl.dropboxusercontent.com/u/219 … d_perf.zip