audio_sound_loop

This function enables or disables looping for a playing sound instance (returned by any of the audio_play_sound_ functions).

NOTE This function will set the loop state of a playing sound but the sound will not loop if the track position is already past the loop end point. Set the track position to a position before the loop end point using audio_sound_set_track_position or set the loop end point past the track position so the end point can be reached.

 

Syntax:

audio_sound_loop(index, state);

ArgumentTypeDescription
indexSound Instance IDThe index of the sound instance
stateBooleanWhether to loop the sound between the loop start and end or not

 

Returns:

N/A

 

Example:

snd_car1 = audio_play_sound(snd_car, 100, false);
audio_sound_loop(snd_car1, true);

The above example calls audio_play_sound to play a sound snd_car, not looping. The new sound instance is stored in a variable snd_car1. Then audio_sound_loop is called to enable looping for the sound.