audio_sound_length


描述

This function will return the length of the given sound in seconds. The sound can either be a referenced from index for an individual sound being played which has been stored in a variable when using the audio_play_sound or audio_play_sound_at functions, or an actual sound asset from the resource tree.


语法:

audio_sound_length(index);


参数 描述
index The index of the sound to check.


返回:

Real(实数)


例如:

var len;
len = audio_sound_length(snd_Beam);
audio_play_sound(snd_Beam, 1, false);
alarm[0] = room_speed * len;

The above code gets the length (in seconds) of the sound indexed in the variable "snd_Beam", then plays the sound and sets an alarm to go off when the sound has finished playing using the length of the sound to calculate the time needed for the alarm.