diff options
author | David Runge <dave@sleepmap.de> | 2016-07-14 13:07:07 +0200 |
---|---|---|
committer | David Runge <dave@sleepmap.de> | 2016-07-14 13:07:07 +0200 |
commit | 32f7a4f35d3b63ef9f12f396cd7fb7f9dc18a351 (patch) | |
tree | f97e515a9cef994056cdf1e39a31a698635174ae | |
parent | 52a2ea1b919c3716da78833ed291bda23c251cc0 (diff) | |
download | bowelyzer-32f7a4f35d3b63ef9f12f396cd7fb7f9dc18a351.tar.gz bowelyzer-32f7a4f35d3b63ef9f12f396cd7fb7f9dc18a351.tar.bz2 bowelyzer-32f7a4f35d3b63ef9f12f396cd7fb7f9dc18a351.tar.xz bowelyzer-32f7a4f35d3b63ef9f12f396cd7fb7f9dc18a351.zip |
classes/Bowelyzer.sc: Adding OSCdef for toggle_all message to toggle all channels on/off simultaneously. Reset global toggle state to true on loading of configuration.
-rw-r--r-- | classes/Bowelyzer.sc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/classes/Bowelyzer.sc b/classes/Bowelyzer.sc index 35aa0c3..cea4c55 100644 --- a/classes/Bowelyzer.sc +++ b/classes/Bowelyzer.sc @@ -140,6 +140,34 @@ Bowelyzer{ srcID: NetAddr.new("127.0.0.1", NetAddr.langPort) ); + // listen for messages to toggle all channels on/off simultaneously + OSCdef.newMatching( + key: \toggle_all, + func: {|msg, time, addr, recvPort| + var type = msg[0], + toggle = msg[1]; + postln("Received: "++msg); + switch(toggle, + 0,{ + config.config.at(\controls).pairsDo({|name, controls| + controls.put(\active, true); + analyzer.startAnalysisSynth(name); + gui.setCurrentToggleState(name, true); + }); + }, + 1,{ + config.config.at(\controls).pairsDo({|name, controls| + controls.put(\active, false); + analyzer.stopAnalysisSynth(name); + gui.setCurrentToggleState(name, false); + }); + } + ); + }, + path: "/toggle_all", + srcID: NetAddr.new("127.0.0.1", NetAddr.langPort) + ); + // listen for address messages to change OSC addresses OSCdef.newMatching( key: \address, @@ -242,6 +270,7 @@ Bowelyzer{ gui.setupHubView(config.config); gui.setupForwardView(config.config); gui.setCurrentConfigFilePath(config.configFilePath); + gui.setCurrentGlobalToggleState(true); },{ ("Configuration could not be read: "++fileName).error; }); |