2 // uid is not set by connect, in order to enable several connections to one output. set the uid directly, if you only want to send data to one MIDI destination.
3 connect{ arg device = 0;
4 MIDIOut.connect( port, device );
9 if(MIDIClient.initialized.not,{ MIDIClient.init });
10 if ( device > MIDIClient.destinations.size, {
13 dest = MIDIClient.destinations.at(device);
15 "MIDIClient failed to init".warn;
17 cuid = MIDIClient.destinations.at(device).uid;
24 if(device.isKindOf(MIDIEndPoint), {cuid = device.uid}); // else error
26 MIDIOut.connectByUID( port,cuid );*/
30 MIDIOut.disconnect( port, cuid );
31 // MIDIOut.disconnectByUID(port,cuid);
35 *connect { arg outport=0, device=0;
37 if(MIDIClient.initialized.not,{ MIDIClient.init });
40 if ( device > MIDIClient.destinations.size, {
41 dest = MIDIClient.destinations.select{ |it| it.uid == device }.first;
43 ("MIDI device with uid"+device+ "not found").warn;
48 dest = MIDIClient.destinations.at(device);
50 "MIDIClient failed to init".warn;
52 uid = MIDIClient.destinations.at(device).uid;
59 if(device.isKindOf(MIDIEndPoint), {uid = device.uid}); // else error
61 this.connectByUID(outport,uid);
63 *disconnect { arg outport=0, device=0;
65 if(device.isKindOf(MIDIEndPoint), {uid = device.uid});
67 if(device.isPositive, {
68 if ( device > MIDIClient.destinations.size, {
69 dest = MIDIClient.destinations.select{ |it| it.uid == device }.first;
71 ("MIDI device with uid"+device+ "not found").warn;
76 uid = MIDIClient.destinations.at(device).uid
82 this.disconnectByUID(outport,uid);
84 *connectByUID {arg outport, uid;
87 *disconnectByUID {arg outport, uid;