audio_stop_sound

Stops the indicated sound.

Syntax:

audio_stop_sound(index);


Argument Description
index The index of the sound to stop.


Returns: N/A


Description

This function will stop the given sound 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_sound or audio_play_sound_at functions) or a sound asset, in which case all instances of the given sound will be stopped.


Example:

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.


Back: Audio
Next: audio_stop_all
© Copyright YoYo Games Ltd. 2018 All Rights Reserved