Modality-toolkit
Modality-toolkit copied to clipboard
Multiple identical controllers kind of broken
Hello there,
i've been trying out different approaches to use multiple identical controllers (currently 2x akai midimix, so it's via protocol 'midi')
i'm on linux and using SuperCollider 3.12.0
been using this type of initialization:
m = MKtl('mm',"akai-midimix",multiIndex:0);
q = MKtl('sq',"akai-midimix",multiIndex:1);
but when i create the second one it throws me an error “ERROR: Message ‘at’ not understood.”
after investigating a bit i've found the culprit to be in MIDIMKtlDevice.sc
the following lines:
foundInfo = MKtlLookup.findByIDInfo(idInfo)
.at(multiIndex ? 0);
seem to break with an index>0 (there are multiple devices and multiIndex seems to be seen correctly:
Meta_MKtlDevice:open: multiple device candidates found, please disambiguate by providing a multiIndex!
The candidates are:
multiIndex 0: ( 'idInfo': ( 'destPortIndex': 0, 'srcPortIndex': 0, 'deviceName': "MIDI Mix" ), 'protocol': 'midi', 'destDevice': MIDIEndPoint("MIDI Mix", "MIDI Mix MIDI 1", 1310720), 'filenames': [ ],
'multiIndex': 0, 'srcDevice': MIDIEndPoint("MIDI Mix", "MIDI Mix MIDI 1", 1310720), 'deviceName': "MIDI Mix", 'descs': [ ], 'lookupName': 'midi_3_midi_mix_nr_1',
'deviceInfo': MIDIEndPoint("MIDI Mix", "MIDI Mix MIDI 1", 1310720) )
multiIndex 1: ( 'idInfo': ( 'destPortIndex': 1, 'srcPortIndex': 1, 'deviceName': "MIDI Mix" ), 'protocol': 'midi', 'destDevice': MIDIEndPoint("MIDI Mix", "MIDI Mix MIDI 1", 2097152), 'filenames': [ ],
'multiIndex': 1, 'srcDevice': MIDIEndPoint("MIDI Mix", "MIDI Mix MIDI 1", 2097152), 'deviceName': "MIDI Mix", 'descs': [ ], 'lookupName': 'midi_4_midi_mix_nr_2',
'deviceInfo': MIDIEndPoint("MIDI Mix", "MIDI Mix MIDI 1", 2097152) )
so it seems that MKtlLookup.findByIDInfo(idInfo) does not seem to return an array where each entry is one of the devices, but something different? I tried "hotfixing" by changing the line to:
foundInfo = MKtlLookup.findByIDInfo(idInfo)[0];
which seems to work for both controllers as inputs, but now i can't send midi back, using messages like:
MKtl(\mm).elAt(\bt,0,1,0).value_(127);
MKtl(\sq).elAt(\bt,0,1,0).value_(127);
will always send to both devices.
it seems to me that the evaluation of multiIndex isnt working correctly, at least for MIDIMKtls.