|
-
Oct 31st, 1999, 10:41 PM
#1
Few short questions about MIDIs in VB:
1) How to play/stop/pause a MIDI? (an example or link to one would be nice if possible)
2) How to play more than one MIDI at the same time?
3) How to detect if a MIDI has stopped playing? (to start it again so it goes on repeating)
Any help is appreciated and, of cource, welcome!
-
Jun 11th, 2002, 03:59 AM
#2
Fanatic Member
After 3 and half years, here is the reply 
VB Code:
'This project needs a Common Dialog box, named 'CDBox'
' (To add the Common Dialog Box to your tools menu, go to Project->Components (or press CTRL-T)
' and select Microsoft Common Dialog control)
Private 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
Dim Alias As String
Private Sub Form_Load()
'KPD-Team 1998
'URL: [url]http://www.allapi.net/[/url]
Const PlayTime = 10
'Set the common dialog box' title
CDBox.DialogTitle = "Choose your midi-file"
'Set the filter
CDBox.Filter = "Midi-files (*.mid)|*.mid"
'Show the 'Open File'-dialog
CDBox.ShowOpen
'Extract an alias from the file
Alias = Left$(CDBox.FileTitle, Len(CDBox.FileTitle) - 4)
'play midi
R% = mciSendString("OPEN " + CDBox.filename + " TYPE SEQUENCER ALIAS " + Alias, 0&, 0, 0)
R% = mciSendString("PLAY " + Alias + " FROM 0", 0&, 0, 0)
R% = mciSendString("CLOSE ANIMATION", 0&, 0, 0)
'play midi for 10 secs
t = Timer
Do: DoEvents: Loop Until Timer > t + PlayTime
'stop midi and close it
R% = mciSendString("OPEN " + CDBox.filename + " TYPE SEQUENCER ALIAS " + Alias, 0&, 0, 0)
R% = mciSendString&("STOP " + Alias, 0&, 0, 0)
R% = mciSendString&("CLOSE ANIMATION", 0&, 0, 0)
End Sub
THE TIME/WEATHER IS 
Don't know how to use APIs or have problem with them,
Download API-Guide & API-Viewer from http://www.allapi.net
-
Jun 21st, 2002, 03:21 AM
#3
Hyperactive Member
haha, you know, he could be dead by now
-
Jun 22nd, 2002, 02:39 AM
#4
Fanatic Member
I just click on the 'Go to last page link' on the General VB Question Topics. This was the last thread with 0 replies
There were 6500+ threads. (since 1999)
THE TIME/WEATHER IS 
Don't know how to use APIs or have problem with them,
Download API-Guide & API-Viewer from http://www.allapi.net
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|