Firelight Technologies FMOD Studio API
Channel::setLoopCount
Sets a channel to loop a specified number of times before stopping.
C++ Syntax
FMOD_RESULT Channel::setLoopCount(
int loopcount
);
C Syntax
FMOD_RESULT FMOD_Channel_SetLoopCount(
FMOD_CHANNEL *channel,
int loopcount
);
C# Syntax
RESULT Channel.setLoopCount(
int loopcount
);
JavaScript Syntax
Channel.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:
When changing the loop count, sounds created with System::createStream or FMOD_CREATESTREAM may have already 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 by calling Channel::setPosition. Note this will usually only happen if you have sounds or loop points that are smaller than the stream decode buffer size.
See Also
- Channel::getLoopCount
- Channel::setPosition
- System::createStream
- System::setStreamBufferSize
- FMOD_CREATESOUNDEXINFO
- FMOD_MODE
Version 1.10.03 Built on Feb 1, 2018