From: Eugene Petkevich Date: Sat, 7 May 2022 08:36:25 +0000 (+0300) Subject: Change exception to if-else X-Git-Url: https://git.zuelum.org/?a=commitdiff_plain;h=bf2118bae0cfae2109506c2410e502c435923ae0;p=scprojects.git Change exception to if-else --- diff --git a/push-control.scd b/push-control.scd index f0b0a64..67d2785 100644 --- a/push-control.scd +++ b/push-control.scd @@ -6,6 +6,7 @@ ( ~pushFactory = { + var dest; var push = Environment[ \version -> "33.7.2.5", @@ -177,6 +178,23 @@ }; //============================== 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"); @@ -184,6 +202,7 @@ // mac os push.pushOut = MIDIOut.newByName("Ableton Push", "User Port"); }; + */ push.pushOut.latency_(0); if (push.pushOut==nil, {"Cannot control push LEDs!"});