(
~pushFactory = {
+ var dest;
var push = Environment[
\version -> "33.7.2.5",
};
//============================== LED control
+ dest = MIDIClient.destinations.detect({ |item|
+ var res = false;
+ if (item.device == "Ableton Push", {
+ if (item.name == "Ableton Push MIDI 2", {
+ res = true;
+ });
+ if (item.name == "User Port", {
+ res = true;
+ });
+ });
+ res;
+ });
+ push.pushOut = MIDIOut.newByName(dest.device, dest.name);
+ // The following is working by itself,
+ // but factory function assignment to global var
+ // returns nil
+ /*
try {
// linux
push.pushOut = MIDIOut.newByName("Ableton Push", "Ableton Push MIDI 2");
// mac os
push.pushOut = MIDIOut.newByName("Ableton Push", "User Port");
};
+ */
push.pushOut.latency_(0);
if (push.pushOut==nil, {"Cannot control push LEDs!"});