audio_emitter_exists

Checks whether the given emitter exists.

Syntax:

audio_emitter_exists(index);


Argument Description
index The index of the emitter to check the existence of.


Returns: Boolean


Description

This function returns whether an audio emitter exists (true) or not (false). Note that if the index you search for has not been initialised previously, this function will cause an error as it is searching for non-existent indices.


Example:

if audio_emitter_exists(s_emit)
   {
   audio_play_sound_on(s_emit, snd_Explode, false, 1);
   }
else
   {
   s_emit = audio_emitter_create();
   audio_play_sound_on(s_emit, snd_Explode, false, 1);
   }

The above code checks to see if an emitter exists, indexed in the (previously initialised) variable "s_emit". If it does then a sound is played through it, but if it does not, it is created and then the sound is played.


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