We have just updated our sound engine to use Fmod. It works fine on most computers, but it lags on some laptops with slower HDDs.
The lag happens when a sound is played and causes the game to freeze for 0.5-1 second.

I dont have that much experience working with Fmod so I’m wondering what basic things I can look at when trying to figure out what is causing the lag?

FMOD_MODE lModeFlags=0;
lModeFlags |= FMOD_UNICODE;
lModeFlags |= FMOD_SOFTWARE;

if(abStream) lModeFlags |= FMOD_CREATESTREAM;

if(abLoop) lModeFlags |= FMOD_LOOP_NORMAL;
else lModeFlags |= FMOD_LOOP_OFF;

if(ab3D) lModeFlags |= FMOD_3D;
else lModeFlags |= FMOD_2D;

if(abNonBlockingLoad) lModeFlags |= FMOD_NONBLOCKING;

lResult = mpSystem->createSound((const char*)asFile.c_str(), lModeFlags, 0, &mpSound);

This is the code we use to play the sound.

  • You must to post comments

It could be over use of streaming sounds, that will put additional strain on the HDD as every single sound will be constantly touching the disk. It is generally recommended to use streams for long unique sounds like music and dialog and use compressed sample for short repeated sounds like sound effects. I also noticed that the non-blocking flag is conditional, if it is [i:23s4jqyc]not[/i:23s4jqyc] non-blocking (i.e. blocking) it will fill block the main thread while it fills the stream buffers, usually this wouldn’t be as long as a half a second but with slow disk access and lots streams thrashing the disk that could be the cause.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.