Loop sound on/off

Hi,

Using FMOD core in a c++ game project.

When loading a level all required SFX (ogg) are preloaded using:
_system->createSound(filePath, FMOD_DEFAULT , &exinfo, &sound);

What is the difference between:

  • using FMOD_LOOP_NORMAL + channel setLoopCount(0)
  • using FMOD_LOOP_OFF

Some sounds need to be looped, but I’m thinking if there is any reason for not just loading all sounds with FMOD_LOOP_NORMAL and setting LoopCount when needed? Thanks!

Hi,

There’s no functional difference between your two stated examples. Both will cause a sound to play as a one-shot, and as such there shouldn’t be any reason to not just create all sounds with FMOD_LOOP_NORMAL.

The only difference worth noting when compared to creating a sound with FMOD_LOOP_OFF is that there’s a gap between sound creation and calling Channel::setLoopCount, though this is unlikely to have an effect unless you’re doing things to the sound after creation but before setting the loop count.

Hope this helps!

Perfect, thanks!