PlayMusic (filename$[,flags])

Parameters

filename$ - name of music file. Formats supported: raw/mod/s3m/xm/it/mid/rmi/wav/mp2/mp3/ogg/wma/asf
flags = optional playback flags

Description

This command will load and play a music file.

You can't 'preload' the audio like you can a sound sample via the LoadSound command. Every time you call the PlayMusic command, the file is reloaded and played. This means that if you use the command while some graphics are moving on-screen, you may get a slight pause when the hard drive seeks and grabs the music file. To avoid this, you might want to use the PlaySound/LoopSound commands instead.

The returned value is a 'channel handle'. Various channel commands allow you to modifiy the music
while it is playing in realtime.

The optional flags variable can be of the following values:

1: Loop the music
2: Initially pause the music
3: Loop and pause the music

If a paused flag is specified, you must use ResumeChannel to actually start the audio output.

Pausing music before playback allows you to setup various channel parameters before the music
actually starts playing.

Example

; Load and play the background music

chnBackground=PlayMusic("music\background.wav")

Index

Click here to view the latest version of this page online