Loading ...
Sorry, an error occurred while loading the content.

WG: [libertybasic] MIDI receiver

Expand Messages
  • pendl2megabit
    Message 1 of 1 , Jun 1, 2006
    • 0 Attachment
      > LB4.02 cannot read those two lines:
      >
      > lpMidiInCaps.vDriverVersion.struct
      > ....
      > winstring(lpMidiInCaps.szPname$.struct)
      > .....

      After a pleasant sleep, I corrected the structure, to use the correct type
      for the version number:
      '---code start
      titlebar "Get MIDI Info"

      MMSYSERR.NOERROR = 0
      CALLBACK.FUNCTION = hexdec("30000")

      calldll #winmm, "midiInGetNumDevs",_
      devCount as ulong
      print
      print "Number of MIDI input devices = "; devCount

      if devCount then
      struct lpMidiInCaps,_
      wMid as word,_
      wPid as word,_
      vDriverVersion as ushort,_
      szPname$ as char[32],_
      dwSupport as ulong

      cbMidiInCaps = len(lpMidiInCaps.struct)

      for uDeviceID = 0 to devCount - 1
      calldll #winmm, "midiInGetDevCapsA",_
      uDeviceID as ulong,_
      lpMidiInCaps as struct,_
      cbMidiInCaps as ulong,_
      result as ulong

      if result = MMSYSERR.NOERROR then
      print
      print "Device ID ......... "; uDeviceID
      print "Manufacturer ID ... "; lpMidiInCaps.wMid.struct
      print "Product ID ........ "; lpMidiInCaps.wPid.struct
      print "Driver Version .... ";
      SplitShort$(lpMidiInCaps.vDriverVersion.struct)
      print "Product Name ...... ";
      winstring(lpMidiInCaps.szPname$.struct)
      end if
      next

      struct lphMidiIn, value as ulong

      dwFlags = CALLBACK.FUNCTION

      callback dwCallback, MidiInProc(ulong, ulong, ulong, ulong, ulong),
      void

      calldll #winmm, "midiInOpen",_
      lphMidiIn as struct,_
      uDeviceID as ulong,_
      dwCallback as ulong,_
      dwCallbackInstance as ulong,_
      dwFlags as ulong,_
      result as ulong

      if result = MMSYSERR.NOERROR then
      hMidiIn = lphMidiIn.value.struct

      calldll #winmm, "midiInReset",_
      hMidiIn as ulong,_
      result as ulong

      calldll #winmm, "midiInClose",_
      hMidiIn as ulong,_
      result as ulong
      end if
      end if
      end

      function MidiInProc(hMidiIn, wMsg, dwInstance, dwParam1, dwParam2)
      print hMidiIn, wMsg, dwInstance, dwParam1, dwParam2
      end function

      function SplitShort$(number)
      hexstring$ = right$("0000"; dechex$(number), 4)
      major = hexdec(left$(hexstring$, 2))
      minor = hexdec(right$(hexstring$, 2))
      SplitShort$ = major; "."; minor
      end function
      '---code end
      ---
      Stefan Pendl






      ___________________________________________________________
      Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de
    Your message has been successfully submitted and would be delivered to recipients shortly.