Sounds

Game Maker 8

Sounds

The following routines can be used to create new sounds and to remove them.

sound_add(fname,kind,preload) Adds a sound resource to the game. fname is the name of the sound file. kind indicates the kind of sound (0=normal, 1=background, 2=3d, 3=mmplayer) preload indicates whether the sound should immediately be stored in audio memory (true or false). The function returns the index of the new sound, which can be used to play the sound. (-1 if an error occurred, e.g. the file does not exist).
sound_replace(index,fname,kind,preload) Same as the previous function but this time a new sound is not created but the existing sound index is replaced, freeing the old sound. Returns whether correct.
sound_delete(index) Deletes the indicated sound, freeing all memory associated with it. It can no longer be restored.