'Winmm.dll
'Mmsystem.h

uses minwin
uses minmidi




  ' Setup for MIDI
  '===============
  '
  MIDIOUTCAPSA moc
  sys hMidi
  int er=midiOutOpen(hMidi, 0, 0, 0, CALLBACK_NULL) ' 0=synth a 2=soft synth
  midiOutShortMsg(hMidi, 0xff)         'reset
  midiOutShortMsg(hMidi, 0x79B0)       'reset all controllers
  midiOutShortMsg(hMidi, 0xC0+014*256) 'program assign
  midiOutShortMsg(hMidi, 0xC1+101*256) 'program assign
  midiOutShortMsg(hMidi, 0x3001B1)     'modulation wheel
  'velocity pitch  command channel
  'byte3   byte2 nybble2 nybble1
  '
  midiOutShortMsg(hMidi, 0x00403C91)
  sleep 100
  midiOutShortMsg(hMidi, 0x00404C90)
  Sleep(2000)
  midiOutShortMsg(hMidi, 0x00003C81)
  midiOutShortMsg(hMidi, 0x00004C80)
  sleep(1000)
  midiOutClose(hMidi)



  function ShowMidiCaps() as string
  =================================
  string pr
  sys en=midiOutGetNumDevs()
  pr="Device Capabilities" cr cr
  pr+="Midi output devices: "  tab en cr
  int i
  for i=0 to en-1
    midiOutGetDevCapsA(i, moc, SIZEOF(MIDIOUTCAPSA))
    pr+=
    "wMid           " tab moc.wMid cr+
    "ID             " tab moc.wPid cr+
    "Driver Version " tab moc.vDriverVersion cr+
    "Name           " tab moc.szPname cr+
    "Technology     " tab moc.wTechnology cr+
    "Voices         " tab moc.wVoices cr+
    "Notes          " tab moc.wNotes cr+
    "Channel Mask   " tab moc.wChannelMask cr+
    "Support        " tab moc.dwSupport cr+
    ""
    'pr+= i tab moc.szPname tab moc.wVoices tab moc.wNotes cr
  next
  return pr
  end function

print ShowMidiCaps

