audio_is_playing

This function will check the given sound to see if it is currently playing.

The sound can either be a single instance of a sound (the index for individual sounds being played can be stored in a variable when using the audio_play_soundaudio_play_sound_ataudio_play_sound_on and audio_play_sound_ext functions) or a sound asset, in which case all instances of the given sound will be checked and if any of them are playing the function will return true otherwise it will return false.

NOTE This function will still return true if the sound being checked has previously been paused using the audio_pause_sound function.

 

Syntax:

audio_is_playing(index);

ArgumentTypeDescription
indexSound Asset or Sound Instance IDThe index of the sound to check.

 

Returns:

Boolean

 

Example:

if !audio_is_playing(snd_Waterfall)
{
    audio_play_sound_at(snd_Waterfall, x, y, 0, 300, true, 1);
}

The above code checks to see if the sound indexed in the variable "snd_Waterfall" is currently playing and if it returns false then the sound will be looped at its room position, with a fall-off distance of 300 and a low priority.