06-09-2007, 01:58 AM
Code:
Public CurrentSong As String
Dim mssg As String * 255
Dim MIDIpos As Integer
Dim MIDILength As Integer
Public Sub PlayMidi(Song As String)
Dim i As Long
If CurrentSong Song Then
i = mciSendString("close all", 0, 0, 0)
i = mciSendString("open """ & App.Path & MUSIC_PATH & Song & """ type sequencer alias background", 0, 0, 0)
i = mciSendString("play background notify", 0, 0, frmMirage.hWnd)
i = mciSendString("status background length", mssg, 255, 0)
MIDILength = mssg
CurrentSong = Song
Else
If MIDILength = MIDIpos Then
i = mciSendString("play background from 0", 0&, 0, 0)
End If
End If
i = mciSendString("status background position", mssg, 255, 0)
MIDIpos = mssg
End Sub
Just place:
Code:
If Map.Music > 0 Then
Call PlayMidi("music" & Trim(STR(Map.Music)) & ".mid")
End If
.....into GameLoop
I know a lot of people have switched to directsound, Fmod, etc.