Designing Games with GameMaker
Sounds
The following functions will give you information about a sound:
sound_exists(ind) Returns whether a sound with the given index exists.
sound_get_name(ind) Returns the name of the sound with the given index.
sound_get_kind(ind) Returns the kind of the sound with the given index (0=normal, 1=background, 2=3d, 3=mmplayer).
sound_get_preload(ind) Returns whether the sound with the given index has preload set.
Sounds use many resources and most systems can store and play only a limited number of sounds. If you make a large game you would like to have more control over which sounds are loaded in audio memory at what times. You can use the switch off the preload option for sounds to make sure sounds are only loaded when used. This though has the problem that you might get a small hiccup when the sound is used first. Also, sounds are not automatically unloaded when you don't need them anymore. For more control you can use the following functions.
sound_discard(index) Frees the audio memory used for the indicated sound.
sound_restore(index) Restores the indicated sound in audio memory for immediate playing.
« Sprites | Backgrounds »
Alternative versions
You can also read this manual on one single long page (± 1.5 mb)
Also available in:
Download helpfile
Also available in:
Download helpfile