This function will stop the given sound if it is currently playing. This includes all sounds that have been paused using audio_pause_sound or audio_pause_all.
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_sound or audio_play_sound_at functions) or a sound asset, in which case all instances of the given sound will be stopped.
If you pass it an Audio Queue ID, it will remove all buffers from that queue and run the Audio Playback event for each buffer removed, with the key "queue_shutdown" set to 1.
NOTE This function triggers an Audio Playback Ended Async Event for every sound instance that is affected by it.
audio_stop_sound(index);
Argument | Type | Description |
---|---|---|
index | Sound Asset or Sound Instance ID or Audio Queue ID | The index of the sound to stop. |
N/A
if (!global.SFX)
{
audio_stop_sound(snd_Waterfall);
}
else
{
audio_play_sound_at(snd_Waterfall, x, y, 0, 100, 300, 1, true, 1);
}
The above code checks the global variable "SFX" and if it returns false, it will stop the sound indexed in the variable "snd_Waterfall" that is currently playing, and if it returns true, it will loop the sound.