This is a quite short chapter as sound playback is a relatively simple affair. You handle sounds in a similar fahion to sprites, each sound is associated to an ID.
There are 3 main commands for sound playback.
LOADSOUND "Boom.wav", 0, 1
LOADSOUND : This command loads a sound ('Boom.wav')to memory, assigning an ID ('0'). The ID is just like the ID used with the LOADSPRITE command. From that point forward you use the ID to access the sound.
The last parameter is the Buffers parameter, this defines how many channels will be opened up for this sound (polyphony). Be aware that the size of each buffer is equal to the length of the sound.
The only supported sound format is Wav-PCM.
PLAYSOUND (n, pan, vol)
This plays a loaded sound. The command requires 3 arguments.
1st : The ID of the preloaded sound
2nd : The stereo-fading. -1.0 means left, 0 = center and +1.0 is right side.
3rd : The volume. 0.0=off, 1.0=loudest.
This command immediately stops all sound playback.
You can use music playback in one of the following formats : mp3, wav, midi.
To interract with music use the following commands:
PLAYMUSIC "mytune.mp3", will start the playback of the MP3 file "mytune.mp3".
Stops the playback of all music.