bear
New Member

 MIDI-OX Rules!
Posts: 2
|
 |
Converting SYSEX MMC to CC
« on: Sep 9th, 2007, 2:56am » |
Quote Modify
|
My specific problem - use the transport on a roland VS1680 (sysex MMC) to some CC that reaper can "learn" I came up with the following ' MIDIOX VS1680 MMC message translator ' Don Speirs 09/08/07 ' Ver 0.0.0 ' Derived from example MOXScriptPOLL provided by MidiOX option explicit dim mox dim str, strWrk dim n, ii, nInst, i dim bGo dim chan, stat, dat1, dat2 dim msg, msgstr, strSysEx, strSysExmod, strPos dim A ' Wsh version Str = Wscript.Name & " ver. " & Wscript.Version ' Create object Set mox = WScript.CreateObject("Midiox.MoxScript.1") ' *** MIDI Input loop *** mox.FireMidiInput = 0 mox.DivertMidiInput = 1 Do While mox.ShouldExitScript = 0 msg = mox.GetMidiInputRaw() If msg <> 0 Then stat = msg And &h000000FF ' if message is SysEx, must ask for SysEx string message If (stat = &hF0) Then strSysEx = mox.GetSysExInput() strSysExmod = mid(strSysEx,13,2) Select Case strSysExmod Case "01" ' STOP BUTTON - send CC 0x55 mox.OutputMidiMsg -1, &hB0, &h55, &h00 Case "03" ' PLAY BUTTON - send CC 0x56 mox.OutputMidiMsg -1, &hB0, &h56, &h00 Case "06" ' RECORD ON (toggles) - send CC 0x57 mox.OutputMidiMsg -1, &hB0, &h57, &h00 Case "07" ' RECORD OFF (toggles) - send CC 0x58 mox.OutputMidiMsg -1, &hB0, &h58, &h00 Case "44" ' |<< or << or >> or jogwheel sends position messages ' Kludge up some kind of interpretation strPos = mid(strSysEx,22,2) If strPos = "60" Then strPos = "00" Else strPos = "10" End If strPos = strPos & mid(strSysEx,25,2) strPos = strPos & mid(strSysEx,28,2) strPos = strPos & mid(strSysEx,31,2) strPos = strPos & mid(strSysEx,34,2) ' The |<< button returns a position message with position 0 if strPos = "0000000000" Then mox.OutputMidiMsg -1, &hB0, &h59, &h00 ' TODOTODOTODO figure out what to do with the << >> and jog wheel End if Case Else msgbox "What the heck is that " End Select Else ' if message is not SYSEX just pass it through msg = msg \ 256 ' pull off stat dat1 = msg And &h0000007F msg = msg \ 256 dat2 = msg And &h0000007F mox.OutputMidiMsg -1, stat, dat1, dat2 End If End If Loop ' Cleanup and exit MidiOx mox.DivertMidiInput = 0 Set str = nothing Set strWrk = nothing Set mox = nothing ' Exit Point '------------------------------------------ Critique? Is there a way to do this better? Specific question - what would be the best way to convert a multiple char string (HR:MIN:SEC:FRAME:SUBFRM) in hex to a a numeric value?
|