diff options
author | David Runge <dave@sleepmap.de> | 2016-07-09 06:29:09 +0200 |
---|---|---|
committer | David Runge <dave@sleepmap.de> | 2016-07-09 06:29:09 +0200 |
commit | 0f3042be76212505404e1860011e529b803b0e52 (patch) | |
tree | c9acb5b181408c233675e3875fa009de0ef4dc42 /classes | |
parent | f31e3b3ba212b0ea8feab61d4810ebaa97bb9c64 (diff) | |
download | bowelyzer-0.6.tar.gz bowelyzer-0.6.tar.bz2 bowelyzer-0.6.tar.xz bowelyzer-0.6.zip |
classes/Bowelyzer.sc: Adding OSCdef for adding new channel. Including the add channel Button width to width for resizing of channelContainerView on channel deletion.0.6
Diffstat (limited to 'classes')
-rw-r--r-- | classes/Bowelyzer.sc | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/classes/Bowelyzer.sc b/classes/Bowelyzer.sc index 2ff0e75..ba5eeb8 100644 --- a/classes/Bowelyzer.sc +++ b/classes/Bowelyzer.sc @@ -243,13 +243,44 @@ Bowelyzer{ }); }); // resize the channelContainerView according to new amount of channels - gui.channelContainerView.maxSize_((gui.channelViewWidth*config.config.at(\inputs).size)@gui.channelViewHeight); + gui.channelContainerView.maxSize_(((gui.channelViewWidth*config.config.at(\inputs).size)+gui.buttonWidth)@gui.channelViewHeight); }.defer; }, path: "/free", srcID: NetAddr.new("127.0.0.1", NetAddr.langPort) ); + // listen for messages to add channels + OSCdef.newMatching( + key: \add, + func: {|msg, time, addr, recvPort| + var type = msg[0], + name; + postln("Received: "++msg); + // add a new input to the config + name = config.addInput; + // initialize a new channelView with the name and controls + Routine{ + // resize the container View + gui.channelContainerView.maxSize_(((gui.channelViewWidth*config.config.at(\inputs).size)+gui.buttonWidth)@gui.channelViewHeight); + gui.channelContainerView.asView.bounds_(Rect(0, 0, (gui.channelViewWidth*config.config.at(\inputs).size)+gui.buttonWidth, gui.channelViewHeight)); + // add a new channel View for the controls + gui.setupChannelView(name, config.config); + }.play(AppClock); + // add and start a new Synth by the given name + Routine{ + analyzer.addSynthWithName(name); + 1.wait; + analyzer.startSynthWithNameAndControls(name, config.config.at(\controls).at(name), config.config.at(\inputs).at(name)); + }.play; + // setup a LevelListener for the new Synth + this.setupLevelListener(name, hub.synthServer); + // setup a OSC listener for the Synth by name + hub.addSynthListener(name); + }, + path: "/add", + srcID: NetAddr.new("127.0.0.1", NetAddr.langPort) + ); } // add OSCdefs listening for messages coming from scsynth, to update the GUI @@ -268,7 +299,7 @@ Bowelyzer{ key: \indicate, func: {|msg, time, addr, recvPort| var name = msg[1]; - //postln("Indicate for "++name); +// postln("Indicate for "++name); if(config.config.at(\inputs).includesKey(name),{ if(gui.indicators.includesKey(name),{ gui.indicators.at(name).stop; |