Blitz supports the playback of .mid, .wav, .mp3, and .mod files.
To play a music file, use PlayMusic. For example...PlayMusic "MySong.mid"
If you want a music file to loop, you must continually use the 'MusicPlaying' function to test whether the music has stopped. In addition, it's also a good idea to make sure 'PlayMusic' succeeded before using MusicPlaying. Here's an example...
music_ok=PlayMusic( "mysong.mid" ) ;start song
While Not GetKey() ;while no key has been hit...
If music_ok ;if music playing...
If Not MusicPlaying() ;check if it's stopped. ;play it again, Sam!
music_ok=PlayMusic( "mysong.mid" )
Endif
WendThe idea behind the 'music_ok' variable is to make sure there was no problem playing the music.
If there *was* a problem - eg: the music file is missing! - then you don't want to keep trying to play it over and over, as starting up a piece of music can be a relatively slow process.