Sound replace

Explanation
This function allows you to replace a single sound resource with multiple sounds by loading them as and when needed off disk. Kind indicates the type of music you want as follows: Preload indicates whether the sound should immediately be stored in audio memory (true or false) for faster playing.
 * 0 - Normal
 * 1 - Background
 * 2 - 3D (positional)
 * 3 - Multimedia Player

Example
sound_replace(snd_levelmusic,"audio/retrotheme.mp3",0,false)

The above example will replace whatever sound is in snd_levelmusic with the sound in the filename "audio/retrotheme.mp3".

A good example is a game that has a large number of levels (say 20) and each level has it's own theme tune, if you have 1 sound resource for every level (especially .wav's or .mp3's) the exe will become huge with 20 different pieces of music and the game will take long to start. By using sound_replace you only need 1 sound resource and the music is stored externally and is loaded in when needed, reducing the loading time considerably.

// Depending on the level, load the correct music level = 1 { sound_replace(snd_levelmusic,"audio/retrotheme.mp3",0,) } level = 2 { sound_replace(snd_levelmusic,"audio/spookylevel.wav",0,) } level = 3 { sound_replace(snd_levelmusic,"audio/jolly.midi",0,) }