Author |
Topic: Port number in scripts doesn't match (Read 1886 times) |
|
Lynn
Member
 


Gender: 
Posts: 16
|
 |
Port number in scripts doesn't match
« on: Mar 27th, 2002, 10:14pm » |
Quote Modify
|
The port number returned by the GetInPortID method does not agree with the port value returned in the GetMidiInput method. Run example script below to illustrate this problem. Also compare output of this script with the port numbers as showin in the Midi-Ox INPUT MONITOR and OUTPUT MONITOR windows. SECOND PROBLEM: when a script is being used the port number shown in the OUTPUT MONITOR window is always displayed as 0, regardless of what the output port number really is. THIRD PROBLEM: when a script is NOT being used (no divert), the port number shown in the OUTPUT MONITOR window is the port number of the INPUT device -- not the OUTPUT device as expected. ----------------------------------------------------------- option explicit dim mox dim str, strWrk, id, ts, port, stat, dat1, dat2, A, msgStr Set mox = WScript.CreateObject("MIDIOX.MOXScript.1") ' New interface str = "Open MIDI In Devices: " & mox.OpenMidiInCount & vbCrLf strWrk = mox.GetFirstOpenMidiInDev Do while strWrk <> "" id = mox.GetInPortID( strWrk ) str = str & vbCrLf & CStr( id ) & ") " & strWrk strWrk = mox.GetNextOpenMidiInDev Loop MsgBox Str str = "Open MIDI Out Devices: " & mox.OpenMidiOutCount & vbCrLf strWrk = mox.GetFirstOpenMidiOutDev Do while strWrk <> "" id = mox.GetOutPortID( strWrk ) str = str & vbCrLf & CStr( id ) & ") " & strWrk strWrk = mox.GetNextOpenMidiOutDev Loop MsgBox Str mox.DivertMidiInput = 1 mox.FireMidiInput = 0 Do While mox.ShouldExitScript = 0 msgStr = mox.GetMidiInput() If (msgStr <> "") and (mox.DivertMidiInput = 1) Then A = Split( msgStr, ",", -1, vbTextCompare ) ts = Int(A(0)) port = Int(A(1)) stat = Int(A(2)) dat1 = Int(A(3)) dat2 = Int(A(4)) MsgBox "port=" & CStr( port ) mox.OutputMidiMsg -1, stat, dat1, dat2 End If Loop
|
« Last Edit: Mar 27th, 2002, 10:17pm by Lynn » |
IP Logged |
|
|
|
Jamie OConnell
Administrator
    


Gender: 
Posts: 2027
|
 |
Re: Port number in scripts doesn't match
« Reply #1 on: Mar 28th, 2002, 4:25am » |
Quote Modify
|
Quote:The port number returned by the GetInPortID method does not agree with the port value returned in the GetMidiInput method. |
| At first glance it does appear that there is a one off bug regarding input port number. I'll have to review that. Quote:SECOND PROBLEM: when a script is being used the port number shown in the OUTPUT MONITOR window is always displayed as 0, regardless of what the output port number really is. THIRD PROBLEM: when a script is NOT being used (no divert), the port number shown in the OUTPUT MONITOR window is the port number of the INPUT device -- not the OUTPUT device as expected. |
| Both of these items are related and due to the fact that the port number shown is always the input port, regardless of whether you're looking at the input or the output monitor. But, when data is coming out of the scripting engine it no longer is associated with an input port, and thus a value of 0 is used. If we were to accurately display each output event in the output monitor for each output port, we would technically have to double each output event for each target port. IMO that would be undesirable, and the main reason why the Port Status window was developed: so you could get an indication of this data.
|
« Last Edit: Mar 28th, 2002, 4:38am by Jamie OConnell » |
IP Logged |
--Jamie Music is its own reward.
|
|
|
|