home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / mag&info / ptv3n5.zip / VBMIDI.ARJ / DEMO.BAS next >
BASIC Source File  |  1992-10-15  |  1KB  |  49 lines

  1. Sub Form_Unload (Cancel As Integer)
  2.   ' Close the MIDI device. This must be
  3.   ' done; otherwise it can't be used until
  4.   ' Windows is restarted.
  5.   Call midiOutClose(hmidi)
  6. End Sub
  7.  
  8. Sub Command1_Click ()
  9.   ' The 3 bytes of a MIDI message must be written to lmessage.
  10.   lmessage = istatus Or ichannel Or (idata1 * 256) Or (ldata2 * 65536)
  11.   ' Send the message to the hmidi device handle.
  12.   ic& = midiOutShortMsg(hmidi, lmessage)
  13. End Sub
  14.  
  15. Sub Command2_Click ()
  16.   ' Make sure you close the MIDI device handle
  17.   ' before quitting VB.
  18.   Call midiOutClose(hmidi)
  19.   End
  20. End Sub
  21.  
  22. Sub Text1_Change ()
  23.   ' This is the status byte portion
  24.   ' of the MIDI message.
  25.   ' Convert the value in the text
  26.   ' box to an integer.
  27.   istatus = Val(text1.text)
  28. End Sub
  29.  
  30. Sub Text2_Change ()
  31.   ' This is the channel nybble of
  32.   ' the status byte.
  33.   ichannel = Val(text2.text)
  34. End Sub
  35.  
  36. Sub Text3_Change ()
  37.   ' The first of 2 data bytes.
  38.   ' Convert the value in the text
  39.   ' box to an integer.
  40.   idata1 = Val(text3.text)
  41. End Sub
  42.  
  43. Sub Text4_Change ()
  44.   ' The second of 2 data bytes.
  45.   ' Convert the value in the text
  46.   ' box to an integer.
  47.   ldata2 = Val(text4.text)
  48. End Sub
  49.