-2

FMOD sound stutter when screen off.

following is source code.

result = FMOD_System_CreateSound(gSystem, songPath, FMOD_CREATECOMPRESSEDSAMPLE | FMOD_SOFTWARE, 0, &gSound);
CHECK_RESULT(result);

__android_log_write(ANDROID_LOG_INFO, "path", songPath);

result = FMOD_System_PlaySound(gSystem, FMOD_CHANNEL_FREE, gSound, 0, &gChannel);
CHECK_RESULT(result);
choijuho
  • 75
  • 1
  • 1
  • 8

1 Answers1

2

Stuttering is generally caused by insufficient buffering of audio to handle delays in delivering audio to the speakers. This can be caused by spikes in CPU usage of the application or OS scheduling changes (like an app entering a backgrounded state).

I would recommend experimenting with System::setDSPBufferSize, the default is 1024 (buffer size) x 4 (num buffers). Consider increasing the number of buffers from 4 until the stuttering becomes stable.

Also for Android consider using the Java based AudioTrack output mode with FMOD instead of leaving it up to the default. Use System::setOutput(FMOD_OUTPUTTYPE_AUDIOTRACK) before System::init, this mode is generally more stable.

Mathew Block
  • 1,613
  • 1
  • 10
  • 9