Bowelyzer{ var = 0)),{ // change the input in configuration config.config.at(\inputs).put(name, update.asInteger); analyzer.setSynthControl(name.asSymbol, \inputChannel, update.asInteger); }); } ); }); }); }, path: "/inputs", srcID: NetAddr.new("127.0.0.1", NetAddr.langPort) ); // listen for toggling messages to "mute" channel OSCdef.newMatching( key: \toggle, func: {|msg, time, addr, recvPort| var name = msg[1], toggle = msg[2]; postln("Received: "++msg); if(msg[1].notNil && msg[2].notNil && msg[2].isInteger,{ if(config.config.at(\inputs).includesKey(name),{ switch(toggle, 0,{analyzer.startAnalysisSynth(name)}, 1,{analyzer.stopAnalysisSynth(name)} ); }); }); }, path: "/toggle", srcID: NetAddr.new("127.0.0.1", NetAddr.langPort) ); } // add OSCdefs listening for messages coming from scsynth, to update the GUI addServerListeners{ this.setupIndicatorListener; // add and start a listener for each channel's LevelIndicator config.config.at(\inputs).pairsDo({|key,value| this.setupLevelListener(key, NetAddr.new(config.config.at(\synthServerAddress), config.config.at(\synthServerPort))); }); } // setup a listener for a level indicator by name and source (of synth server) setupIndicatorListener{ // listen for indicator messages OSCdef.newMatching( key: \indicate, func: {|msg, time, addr, recvPort| var name = msg[1]; //postln("Indicate for "++name); if(config.config.at(\inputs).includesKey(name),{ if(gui.indicators.includesKey(name),{ gui.indicators.at(name).stop; gui.indicators.at(name).reset; gui.indicators.at(name).start(AppClock); }); }); }, path: "/indicate", srcID: NetAddr.new("127.0.0.1", NetAddr.langPort) ); } // setup a listener for a level indicator by name and source (of synth server) setupLevelListener{ arg name, server; postln("Setting up LevelListener for: "++name); OSCdef.newMatching( key: \levels_++name, func: {|msg, time, addr, recvPort| var name = msg[0].asString.replace("/levels/", "").asSymbol, value = msg[3].ampdb.linlin(-40, 0, 0, 1), peak = msg[4].ampdb.linlin(-40, 0, 0, 1); //postln("Receiving: "++msg); { gui.channels.do({|channel| if(channel.name.asSymbol == name,{ channel.children.do({|channelChild| if(channelChild.name.asSymbol == \meterAndControls,{ channelChild.children.do({|meterAndControls| if(meterAndControls.name.asSymbol == \meterView, { meterAndControls.children.do({|meterView| if(meterView.isKindOf(LevelIndicator), { //postln("Setting up LevelIndicator for "++name); meterView.value = value; meterView.peakLevel = peak; }); }); }); }); }); }); }); }); }.defer; }, path: "/levels/"++name, srcID: server ); } }