# Command: PlayMusic

PlayMusic (filename$) Definition:

Loads and begins playing a piece of music.

Parameter Description:

filename$= a valid Windows path and filename.

Command Description:

This command will load and play a .WAV. .MID, or .MP3 file (presumably for background or other type music).
You MUST use a channel variable in order to stop or adjust the music playing. You may use StopChannel, PauseChannel, ResumeChannel, etc. with this command.
Oddly, you can't 'preload' the audio like you can a sound sample via the LoadSound command. Everytime you call the PlayMusic command, the file is RELOADED and played. Most of us aren't sure why this methodology was chosen by Blitz, but you will get a hiccup when the hard drive seeks and grabs the music file. In most cases, this will prevent you from using this command for what I'm sure it was intended for. Instead, you might want to use the LoopSound command.

Example:

; Load and play the background music chnBackground=PlayMusic("music\background.wav")

Index