| Mirage Source http://web.miragesource.net/forums/ |
|
| help:Play Midi Problems http://web.miragesource.net/forums/viewtopic.php?f=210&t=458 |
Page 1 of 1 |
| Author: | Not2BeTrusted2 [ Fri Sep 01, 2006 4:40 am ] |
| Post subject: | help:Play Midi Problems |
help me wit this one lol Code: Public Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
Public Sub PlayMidi(Song As String) Dim i As Long i = mciSendString("close all", 0, 0, 0) i = mciSendString("open " & App.Path & "\Music\" & Song & " type sequencer alias background", 0, 0, 0) i = mciSendString("play background notify", 0, 0, frmMirage.hWnd) End Sub this code doesnt work... can someone post a code here to play midis that actually work? |
|
| Author: | halla [ Fri Sep 01, 2006 5:08 am ] |
| Post subject: | |
yeah I can give you the code I use in my snake game... Code: Public Declare Function mciSendString Lib "winmm.dll" Alias _
"mciSendStringA" (ByVal lpstrCommand As String, ByVal _ lpstrReturnString As Any, ByVal uReturnLength As Long, ByVal _ hwndCallback As Long) As Long Public Sub OpenSong() i = mciSendString("open music.mid type sequencer alias mid1", 0&, 0, 0) End Sub Public Sub Play() i = mciSendString("play mid1", 0&, 0, 0) End Sub Ok I put that all in a mod like modSound. "music.mid" you name as the name of your midi song. "mid1" is the name that you give it... you dont have to change this at all unless you want too. Now whenever you want it to play the music add in calls for opensong and play... Call OpenSong Call Play thats all you have to do to get it playing. Now if you want it to loop or something there is more code and I can help you with that if you like. Tell me if you can get it from here. EDIT: I looked at your code actually now and I see that you have the midi file named as 2 different things... thats probably your problem one you have it Background and the other Background something. Try that out. |
|
| Author: | Robin [ Fri Sep 01, 2006 6:48 am ] |
| Post subject: | Re: help:Play Midi Problems |
Not2BeTrusted2 wrote: help me wit this one lol Code: Public Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long Public Sub PlayMidi(Song As String) Dim i As Long i = mciSendString("close all", 0, 0, 0) i = mciSendString("open " & App.Path & "\Music\" & Song & " type sequencer alias background", 0, 0, 0) i = mciSendString("play background notify", 0, 0, frmMirage.hWnd) End Sub this code doesnt work... can someone post a code here to play midis that actually work? you missed out four '""'s Code: Public Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
Public Sub PlayMidi(Song As String) Dim i As Long i = mciSendString("close all", 0, 0, 0) i = mciSendString("open """ & App.Path & "\Music\" & Song & """ type sequencer alias background", 0, 0, 0) i = mciSendString("play background notify", 0, 0, frmMirage.hWnd) End Sub ~Kite |
|
| Author: | Not2BeTrusted2 [ Fri Sep 01, 2006 8:38 pm ] |
| Post subject: | |
ohh thank u but that code wit it kind of lags Code: Public Sub PlayMidi(Song As String)
Dim i As Long i = mciSendString("close all", 0, 0, 0) i = mciSendString("open """ & App.Path & "\Music\" & Song & """ type sequencer alias background", 0, 0, 0) i = mciSendString("play background notify", 0&, 0, frmMirage.hwnd) End Sub and for the other guy above that code wit the mid1 instead of background yes i get that code and i would like to get the loop |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|