diff options
-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; }); |