Adds a new sound from a given file. DEPRECATED


sound_add(fname, kind, preload);

Argument Description
fname The filename of the sound to add.
kind The kind of sound it should be added as (legacy Feature) 0=normal, 1=background, 2=3D, 3=multimedia player, for things like MP3s).
preload Whether the sound should preload into memory immediately (true) or not (false) (legacy Feature) .

Returns: Real


WARNING!: This function has been deprecated and will no longer work!

This function will load a sound file from an external source. This file can be either a *.wav or a *.mp3. The last two arguments are a left over from previous versions of GameMaker and can be set to 0 as they have no effect on the function.

NOTE: Depending on the target platform that is chosen you are limited as to where you can save and load files from. See Reference - Files for more information.

NOTE: You should be aware that if you are using this function in your HTML5 target game to load resources from an external server, then, due to XSS protection in browsers, attempts to load resources from across domains can be blocked and may appear to return blank results.


global.newsound=sound_add(working_directory + '\hello.wav', 0, 0);

This will add a new sound and store the index of this sound in the variable "global.newsound", from file 'hello.wav' and then play it.

Back: Legacy Sound
Next: sound_replace
© Copyright YoYo Games Ltd. 2018 All Rights Reserved