Channel::setLoopPoints

FMOD Studio API

Firelight Technologies FMOD Studio API

Channel::setLoopPoints

Sets the loop points within the channel.

C++ Syntax

FMOD_RESULT Channel::setLoopPoints(
  unsigned int loopstart,
  FMOD_TIMEUNIT loopstarttype,
  unsigned int loopend,
  FMOD_TIMEUNIT loopendtype
);

C Syntax

FMOD_RESULT FMOD_Channel_SetLoopPoints(
  FMOD_CHANNEL *channel,
  unsigned int loopstart,
  FMOD_TIMEUNIT loopstarttype,
  unsigned int loopend,
  FMOD_TIMEUNIT loopendtype
);

C# Syntax

RESULT Channel.setLoopPoints(
  uint loopstart,
  TIMEUNIT loopstarttype,
  uint loopend,
  TIMEUNIT loopendtype
);

JavaScript Syntax

Channel.setLoopPoints(
  loopstart,                       
  loopstarttype,                   
  loopend,                         
  loopendtype                      
);

Parameters

loopstart
Loop start point, this point in time is played so it is inclusive.
loopstarttype
Time format used for the loop start point (see FMOD_TIMEUNIT).
loopend
Loop end point, this point in time is played so it is inclusive.
loopendtype
Time format used for the loop end point (see FMOD_TIMEUNIT).

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

If a sound was 44100 samples long and you wanted to loop the whole sound, loopstart would be 0, and loopend would be 44099, not 44100. You wouldn't use milliseconds in this case because they are not sample accurate.

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




Version 1.10.03 Built on Feb 1, 2018