Code:
reaper.SetMediaTrackInfo_Value(track, "I_RECINPUT", 4096 + 32 + midi_channel)
<0 = no input
0..n = mono hardware input
512+n = rearoute input
1024 = stereo input pair
4096 = MIDI input, if set then low 5 bits represent channel (0=all, 1-16=only chan),
then next 5 bits represent physical input (63=all, 62=VKB)
I can't seem to figure out how this actually works consistently. I'd like to set a desired MIDI input device via a script (toolbar button). I modified Lokasenna's script and it seems to work for some MIDI input devices but not for all because the numbers based on 4096 seem to be inconsistent.
When I save a simple project with only a single MIDI track set to my first MIDI input device ("VMidi 1" from CopperLan), I can find this entry in the rpp file:
REC 0 4736 0 0 0 0 0
Looking up the device's ID in MIDI devices prefs reveals that its ID is 20. 4096 + 20 x 32 equals 4736. I put this value into the script and it works. The formula also works for a few other MIDI input devices. However, if I wanna select my MIDI input "VMidi 8" which has the ID 55, the value I'm getting is 4096 + 55 x 32 = 5856 and it actually works in the script but when I save a project file incl. the MIDI track set to this MIDI input device, I find this entry:
REC 0 5920 0 0 0 0 0
However, using this entry in the script does not work in return. I'm a bit confused.
btw, what does "VKB" mean?
.