
Originally Posted by
fbonito
hi, thanx,
tonight i will try it,
just one question,
how do i select by index?
what is devide8?
is there a script to chose the device in glovepie?
well... 3 questions after all ...
;-)
a line like:
midi.DeviceOut = 1
will select the first midi input port. i just found mine by trial and error before writing some code around the RtMidi lib. they're in the same order as you'll see when choosing a midi in port in the "bomes midi keyboard" or most other apps.
in my example "midi.DeviceOut = 8" just means my 8th device which in that case is "XYpad" (seems devices start at 1 and not 0 as i had assumed before)
it should also be possible to search through devices in glovepie looking for the name of a device to find its index, though i havent tried that.
... a few mins later of quick hacking ...
this script should work. put it at the top of your glovepie script and change "test" to whatever devicename you need. this will open a midi device out port by name:
Code:
var.DevName = "test"
if (var.Init == 0) then
for var.Count = 0 to 20 do
midi.DeviceOut = var.Count
if (midi.OutDevName ~= var.DevName) then
debug = "Selected: " + midi.OutDevName + " at id=" + floor(var.Count)
var.Count = 21 // end the loop
end if
end for
var.init = 1
endif
the code gets run each iteration - so we need to ensure this selection code is only run the very first time - hence the var.init bit
Bookmarks