Sound::setLoopCount

FMOD Studio API

Firelight Technologies FMOD Studio API

Sound::setLoopCount

Sets a sound, by default, to loop a specified number of times before stopping if its mode is set to FMOD_LOOP_NORMAL or FMOD_LOOP_BIDI.

C++ Syntax

FMOD_RESULT Sound::setLoopCount(
  int loopcount
);

C Syntax

FMOD_RESULT FMOD_Sound_SetLoopCount(
  FMOD_SOUND *sound,
  int loopcount
);

C# Syntax

RESULT Sound.setLoopCount(
  int loopcount
);

JavaScript Syntax

Sound.setLoopCount(
  loopcount                        
);

Parameters

loopcount
Number of times to loop before stopping. 0 = oneshot. 1 = loop once then stop. -1 = loop forever. Default = -1

Return Values

If the function succeeds then the return value is FMOD_OK.
If the function fails then the return value will be one of the values defined in the FMOD_RESULT enumeration.

Remarks

Issues with streamed audio. (Sounds created with with System::createStream or FMOD_CREATESTREAM).
When changing the loop count, sounds created with System::createStream or FMOD_CREATESTREAM may already have been pre-buffered and executed their loop logic ahead of time, before this call was even made.
This is dependant on the size of the sound versus the size of the stream decode buffer. See FMOD_CREATESOUNDEXINFO.
If this happens, you may need to reflush the stream buffer. To do this, you can call Channel::setPosition which forces a reflush of the stream buffer.
Note this will usually only happen if you have sounds or looppoints that are smaller than the stream decode buffer size. Otherwise you will not normally encounter any problems.

See Also




Version 1.10.03 Built on Feb 1, 2018