VB MCI Control Does Not Support Recording of MIDI Data (84473)



The information in this article applies to:

  • Microsoft Visual Basic Professional Edition for Windows 2.0
  • Microsoft Visual Basic Professional Edition for Windows 3.0
  • Microsoft Professional Toolkit for Microsoft Visual Basic programming system for Windows

This article was previously published under Q84473

SUMMARY

The Multimedia Device control called MCI (MCI.VBX), consists of a set of high level, device-independent commands that control audio and visual peripherals. However, the MCI control cannot record standard MIDI (Musical Instrument Data Interface) input. This is a limitation of the MCI control, not of Visual Basic for Windows.

Below is an example of using the MCI control to play back a MIDI file.

MORE INFORMATION

The MCI custom control can play back MIDI files if you have the necessary hardware and software installed. Typically, you need a sound board that supports MIDI and Windows, version 3.1 to use the MCI control to play back MIDI files. Windows 3.1 or (Windows 3.0 with Multimedia Extensions version 1.0) supplies MIDI drivers for several well-known hardware add-on boards that support MIDI.

The following is an example of using the MCI control to play back a MIDI file called TEST.MID.

  1. Run Visual Basic for Windows, or from the File menu, choose New Project (press ALT, F, N) if Visual Basic for Windows is already running. Form1 is created by default.
  2. From the File menu, choose Add File. In the Files box, select the MCI.VBX custom control file. The MCI tool appears in the Toolbox.
  3. Add the following code to the Form_Load event procedure:
          Sub Form_Load ()
            MMControl1.PlayVisible = -1
            MMControl1.StopVisible = -1
            MMControl1.FileName = "c:\midi\bach.mid"
            MMControl1.Wait = -1
            MMControl1.DeviceType = "sequencer"
            MMControl1.Command = "open"
          End Sub
    						
  4. Add the following code to your Form_Unload event procedure:
          Sub Form_Unload (Cancel As Integer)
            MMControl1.Command = "close"
          End Sub
    						
  5. Press the F5 key to run the program. Click the play arrow of the MCI control to play the MIDI file.
NOTE: An MIDI file may play, but may not be audible due to MIDI configuration issues such as the MIDI channel and instrument.

Modification Type:MajorLast Reviewed:11/18/2003
Keywords:KB84473