aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Runge <dave@sleepmap.de>2016-07-10 20:10:46 +0200
committerDavid Runge <dave@sleepmap.de>2016-07-10 20:10:46 +0200
commitf1b95d253283fe451d525d9386e60880f38a2160 (patch)
tree237a7a5fb461cbab88da7f79a8239f9cdb822c13
parent393dde90a4b7f3cdabf8b704057c0f8ea2982ca0 (diff)
downloadbowelyzer-f1b95d253283fe451d525d9386e60880f38a2160.tar.gz
bowelyzer-f1b95d253283fe451d525d9386e60880f38a2160.tar.bz2
bowelyzer-f1b95d253283fe451d525d9386e60880f38a2160.tar.xz
bowelyzer-f1b95d253283fe451d525d9386e60880f38a2160.zip
classes/Bowelyzer.sc: Refactoring all GUI functions, formerly using defer to BowelyzerGUI, where they are all deferred to AppClock. classes/BowelyzerGUI.sc: Adding helper functions to properly defer all needed functionality to AppClock. Renaming setChannelName to setChannelText. The function setChannelName now renames the channelView, whereas setChannelText renames the TextField of a channel.
-rw-r--r--classes/Bowelyzer.sc70
-rw-r--r--classes/BowelyzerGUI.sc455
2 files changed, 271 insertions, 254 deletions
diff --git a/classes/Bowelyzer.sc b/classes/Bowelyzer.sc
index a877a89..e1fba76 100644
--- a/classes/Bowelyzer.sc
+++ b/classes/Bowelyzer.sc
@@ -70,19 +70,12 @@ Bowelyzer{
// rename the input
config.config.at(\inputs).put(update.asSymbol, config.config.at(\inputs).at(name));
config.config.at(\inputs).removeAt(name);
- //TODO: refactor into gui function
- Routine{
- // rename the channel View
- gui.channels.do({|channel|
- if(channel.name.asSymbol == name.asSymbol, {
- channel.name = update.asSymbol;
- });
- });
- // OSC indicator: stop old task, remove it and create a new one with updated name
- gui.indicators.at(name).stop;
- gui.indicators.removeAt(name);
- gui.addOSCIndicatorFadeOutTask(update);
- }.play(AppClock);
+ // rename the channelView
+ gui.setChannelName(name, update);
+ // free the old OSC indicator fadeout Task
+ gui.freeOSCIndicatorFadeOutTask(name);
+ // add a new OSC indicator fadeout Task using the new name
+ gui.addOSCIndicatorFadeOutTask(update);
// stop the listener for LevelIndicator by name and start a new one based upon the updated name
OSCdef(("levels_"++name).asSymbol).free;
this.setupLevelListener(update, hub.synthServer);
@@ -104,7 +97,7 @@ Bowelyzer{
hub.startSynthListener(update);
},{
("New name not valid: "++update).error;
- gui.setChannelName(name, name);
+ gui.setChannelText(name, name);
});
},
\input,{
@@ -186,9 +179,7 @@ Bowelyzer{
var path = msg[1];
postln("Received: "++msg);
if(config.configFilePath.isNil || config.configFilePath == "",{
- {
- gui.saveAsAction(nil);
- }.defer;
+ gui.saveAsAction(nil);
},{
config.writeConfigurationFile;
});
@@ -227,24 +218,15 @@ Bowelyzer{
hub.setupSynthListenersFromConfig(config.config);
analyzer.setupSynthsFromConfig(config.config);
config.config.at(\inputs).keysDo({ |name|
- 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);
+ gui.setupChannelView(name, config.config);
// setup a LevelListener for the new Synth
this.setupLevelListener(name, hub.synthServer);
// setup a OSC listener for the Synth by name
hub.addSynthListener(name);
});
// reload the addresses and ports Views
- Routine{
- gui.removeAddressesAndPorts;
- 0.5.wait;
- gui.setupAddressesAndPorts(gui.settingsView, config.config);
- }.play(AppClock);
+ gui.removeAddressesAndPorts;
+ gui.setupAddressesAndPorts(config.config);
},{
("Configuration could not be read: "++fileName).error;
});
@@ -296,13 +278,8 @@ Bowelyzer{
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);
- });
+ gui.pingOSCIndicator(name);
});
},
path: "/indicate",
@@ -320,9 +297,7 @@ Bowelyzer{
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);
- {
- gui.setLevel(name, value, peak);
- }.defer;
+ gui.setLevel(name, value, peak);
},
path: "/levels/"++name,
srcID: server
@@ -340,13 +315,7 @@ Bowelyzer{
name = config.addInput(extName);
});
// 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);
+ gui.setupChannelView(name, config.config);
// add and start a new Synth by the given name
Routine{
analyzer.addSynthWithName(name);
@@ -382,16 +351,7 @@ Bowelyzer{
// remove fadeout task for OSC indicator
gui.freeOSCIndicatorFadeOutTask(name);
// remove GUI elements
- {
- gui.channels.do({|channel,i|
- if(channel.name == name.asString, {
- channel.remove;
- gui.channels.remove(channel);
- });
- });
- // resize the channelContainerView according to new amount of channels
- gui.channelContainerView.maxSize_(((gui.channelViewWidth*config.config.at(\inputs).size)+gui.buttonWidth)@gui.channelViewHeight);
- }.defer;
+ gui.removeChannelView(name, config.config.at(\inputs).size);
}
}
diff --git a/classes/BowelyzerGUI.sc b/classes/BowelyzerGUI.sc
index 5fc0eda..48b1688 100644
--- a/classes/BowelyzerGUI.sc
+++ b/classes/BowelyzerGUI.sc
@@ -109,96 +109,99 @@ BowelyzerGUI{
setupAddressesAndPorts{
arg config;
var forwardView, hubView, synthServerView;
-
- //synthServer
- synthServerView = View(bounds: Rect(0, 0, settingsSubViewSize.x, settingsSubViewSize.y));
- synthServerView.asView.background = Color.fromHexString("#DDDDEF");
- synthServerView.layout = VLayout();
- synthServerView.layout.spacing = 0;
- synthServerView.layout.margins = settingsSubViewMargins;
- synthServerView.name = "synthServer";
- synthServerView.maxSize_(settingsSubViewSize);
- StaticText(synthServerView, Rect(0, 0, 140@buttonHeight)).string_("synthServer").align_(\center);
- this.setupEZText(synthServerView, "address", config.at(\synthServerAddress)).children.do({|item|
- if(item.isKindOf(StaticText),{
- item.align_(\left);
- });
- if(item.isKindOf(TextField),{
- item.align_(\right);
- });
- });
- this.setupEZNumber(synthServerView, "port", config.at(\synthServerPort)).children.do({|item|
- if(item.isKindOf(StaticText),{
- item.align_(\left);
- });
- if(item.isKindOf(NumberBox),{
- item.align_(\right);
- });
- });
- settingsView.layout.insert(synthServerView, 1);
-
- //hub
- hubView = View(bounds: Rect(0, 0, settingsSubViewSize.x, settingsSubViewSize.y));
- hubView.asView.background = Color.fromHexString("#DDDDEF");
- hubView.layout = VLayout();
- hubView.layout.spacing = 0;
- hubView.layout.margins = settingsSubViewMargins;
- hubView.name = "hub";
- hubView.maxSize_(settingsSubViewSize);
- StaticText(hubView, Rect(0, 0, 140@buttonHeight)).string_("hub").align_(\center);
- this.setupEZText(hubView, "address", config.at(\hubAddress)).children.do({|item|
- if(item.isKindOf(StaticText),{
- item.align_(\left);
- });
- if(item.isKindOf(TextField),{
- item.align_(\right);
- });
- });
- this.setupEZNumber(hubView, "port", config.at(\hubPort)).children.do({|item|
- if(item.isKindOf(StaticText),{
- item.align_(\left);
+ {
+ //synthServer
+ synthServerView = View(bounds: Rect(0, 0, settingsSubViewSize.x, settingsSubViewSize.y));
+ synthServerView.asView.background = Color.fromHexString("#DDDDEF");
+ synthServerView.layout = VLayout();
+ synthServerView.layout.spacing = 0;
+ synthServerView.layout.margins = settingsSubViewMargins;
+ synthServerView.name = "synthServer";
+ synthServerView.maxSize_(settingsSubViewSize);
+ StaticText(synthServerView, Rect(0, 0, 140@buttonHeight)).string_("synthServer").align_(\center);
+ this.setupEZText(synthServerView, "address", config.at(\synthServerAddress)).children.do({|item|
+ if(item.isKindOf(StaticText),{
+ item.align_(\left);
+ });
+ if(item.isKindOf(TextField),{
+ item.align_(\right);
+ });
});
- if(item.isKindOf(NumberBox),{
- item.align_(\right);
+ this.setupEZNumber(synthServerView, "port", config.at(\synthServerPort)).children.do({|item|
+ if(item.isKindOf(StaticText),{
+ item.align_(\left);
+ });
+ if(item.isKindOf(NumberBox),{
+ item.align_(\right);
+ });
});
- });
- settingsView.layout.insert(hubView, 2);
-
- //forward
- forwardView = View(bounds: Rect(0, 0, settingsSubViewSize.x, settingsSubViewSize.y));
- forwardView.asView.background = Color.fromHexString("#DDDDEF");
- forwardView.layout = VLayout();
- forwardView.layout.spacing = 0;
- forwardView.layout.margins = settingsSubViewMargins;
- forwardView.name = "forward";
- forwardView.maxSize_(settingsSubViewSize);
- StaticText(forwardView, Rect(0, 0, 140@buttonHeight)).string_("forward").align_(\center);
- this.setupEZText(forwardView, "address", config.at(\forwardAddress)).children.do({|item|
- if(item.isKindOf(StaticText),{
- item.align_(\left);
+ settingsView.layout.insert(synthServerView, 1);
+
+ //hub
+ hubView = View(bounds: Rect(0, 0, settingsSubViewSize.x, settingsSubViewSize.y));
+ hubView.asView.background = Color.fromHexString("#DDDDEF");
+ hubView.layout = VLayout();
+ hubView.layout.spacing = 0;
+ hubView.layout.margins = settingsSubViewMargins;
+ hubView.name = "hub";
+ hubView.maxSize_(settingsSubViewSize);
+ StaticText(hubView, Rect(0, 0, 140@buttonHeight)).string_("hub").align_(\center);
+ this.setupEZText(hubView, "address", config.at(\hubAddress)).children.do({|item|
+ if(item.isKindOf(StaticText),{
+ item.align_(\left);
+ });
+ if(item.isKindOf(TextField),{
+ item.align_(\right);
+ });
});
- if(item.isKindOf(TextField),{
- item.align_(\right);
+ this.setupEZNumber(hubView, "port", config.at(\hubPort)).children.do({|item|
+ if(item.isKindOf(StaticText),{
+ item.align_(\left);
+ });
+ if(item.isKindOf(NumberBox),{
+ item.align_(\right);
+ });
});
- });
- this.setupEZNumber(forwardView, "port", config.at(\forwardPort)).children.do({|item|
- if(item.isKindOf(StaticText),{
- item.align_(\left);
+ settingsView.layout.insert(hubView, 2);
+
+ //forward
+ forwardView = View(bounds: Rect(0, 0, settingsSubViewSize.x, settingsSubViewSize.y));
+ forwardView.asView.background = Color.fromHexString("#DDDDEF");
+ forwardView.layout = VLayout();
+ forwardView.layout.spacing = 0;
+ forwardView.layout.margins = settingsSubViewMargins;
+ forwardView.name = "forward";
+ forwardView.maxSize_(settingsSubViewSize);
+ StaticText(forwardView, Rect(0, 0, 140@buttonHeight)).string_("forward").align_(\center);
+ this.setupEZText(forwardView, "address", config.at(\forwardAddress)).children.do({|item|
+ if(item.isKindOf(StaticText),{
+ item.align_(\left);
+ });
+ if(item.isKindOf(TextField),{
+ item.align_(\right);
+ });
});
- if(item.isKindOf(NumberBox),{
- item.align_(\right);
+ this.setupEZNumber(forwardView, "port", config.at(\forwardPort)).children.do({|item|
+ if(item.isKindOf(StaticText),{
+ item.align_(\left);
+ });
+ if(item.isKindOf(NumberBox),{
+ item.align_(\right);
+ });
});
- });
- settingsView.layout.insert(forwardView, 3);
+ settingsView.layout.insert(forwardView, 3);
+ }.defer;
}
// remove Views for addresses and ports
removeAddressesAndPorts{
- settingsView.children.do({|setting, i|
- if(setting.isKindOf(View) && ((setting.name == "hub") || (setting.name == "synthServer") || (setting.name == "forward")),{
- setting.remove;
+ {
+ settingsView.children.do({|setting, i|
+ if(setting.isKindOf(View) && ((setting.name == "hub") || (setting.name == "synthServer") || (setting.name == "forward")),{
+ setting.remove;
+ });
});
- });
+ }.defer;
}
// setup channel views
@@ -209,11 +212,24 @@ BowelyzerGUI{
});
}
+ // set the View name of a given channel to a given String
setChannelName{
arg name, update;
{
channels.do({|channel|
if(channel.name.asSymbol == name.asSymbol, {
+ channel.name = update.asSymbol;
+ });
+ });
+ }.defer;
+ }
+
+ // set the TextField of a channel to a given String
+ setChannelText{
+ arg name, update;
+ {
+ channels.do({|channel|
+ if(channel.name.asSymbol == name.asSymbol, {
("Channel found: "++name).postln;
channel.children.do({|channelChild|
if(channelChild.name.asSymbol == \inputs, {
@@ -239,83 +255,103 @@ BowelyzerGUI{
setupChannelView{
arg name, config;
var channelView, headView, controlMeterContainerView, meterView, controlsView, controlsFromConfig, levelIndicator;
- channelView = View(channelContainerView.asView, Rect(0, 0, channelViewWidth, channelViewHeight));
- channelView.asView.background = Color.fromHexString("#FEEFEF");
- channelView.name = name.asString;
- channelView.layout = VLayout();
- channelView.layout.spacing = 0;
- channelView.layout.margins = [2,0,2,0];
- channelView.maxSize_(channelViewWidth@channelViewHeight);
- channelView.deleteOnClose_(true);
-
- // adding name textfield of input
- headView = View(channelView.asView, Rect(0, 0, headViewWidth, headViewHeight));
- headView.asView.background = Color.fromHexString("#DDEFDD");
- headView.name = \inputs;
- headView.layout = HLayout();
- headView.layout.spacing = 4;
- headView.layout.margins = [4,0,4,0];
- headView.maxHeight_(headViewHeight);
- Routine{
- 0.5.wait;
- this.setupEZText(headView, "name", name.asString).children.do({|item|
- if(item.isKindOf(StaticText),{item.align_(\left)});
- if(item.isKindOf(TextField),{item.align_(\right)});
+ {
+ channelContainerView.maxSize_(((channelViewWidth*config.at(\inputs).size)+buttonWidth)@channelViewHeight);
+ channelContainerView.asView.bounds_(Rect(0, 0, (channelViewWidth*config.at(\inputs).size)+buttonWidth, channelViewHeight));
+
+ channelView = View(channelContainerView.asView, Rect(0, 0, channelViewWidth, channelViewHeight));
+ channelView.asView.background = Color.fromHexString("#FEEFEF");
+ channelView.name = name.asString;
+ channelView.layout = VLayout();
+ channelView.layout.spacing = 0;
+ channelView.layout.margins = [2,0,2,0];
+ channelView.maxSize_(channelViewWidth@channelViewHeight);
+ channelView.deleteOnClose_(true);
+
+ // adding name textfield of input
+ headView = View(channelView.asView, Rect(0, 0, headViewWidth, headViewHeight));
+ headView.asView.background = Color.fromHexString("#DDEFDD");
+ headView.name = \inputs;
+ headView.layout = HLayout();
+ headView.layout.spacing = 4;
+ headView.layout.margins = [4,0,4,0];
+ headView.maxHeight_(headViewHeight);
+ Routine{
+ 0.5.wait;
+ this.setupEZText(headView, "name", name.asString).children.do({|item|
+ if(item.isKindOf(StaticText),{item.align_(\left)});
+ if(item.isKindOf(TextField),{item.align_(\right)});
+ });
+ this.setupEZPopUpMenu(headView, "input", Server.default.options.numInputBusChannels, config.at(\inputs).at(name));
+ this.setupChannelCloseButton(headView, name);
+ }.play(AppClock);
+
+ controlMeterContainerView = View(channelView.asView, Rect(0, 0, controlMeterContainerViewWidth, controlMeterContainerViewHeight));
+ controlMeterContainerView.asView.background = Color.fromHexString("#DDDDEF");
+ controlMeterContainerView.name = \meterAndControls;
+ controlMeterContainerView.layout = HLayout();
+ controlMeterContainerView.layout.spacing = 0;
+ controlMeterContainerView.layout.margins = [0,0,0,0];
+
+ meterView = View(controlMeterContainerView.asView, Rect(0,0, meterViewWidth, meterViewHeight));
+ meterView.asView.background = Color.fromHexString("#EEEFEE");
+ meterView.name = \meterView;
+ meterView.layout = VLayout();
+ meterView.maxWidth = meterViewWidth;
+ meterView.layout.spacing = 0;
+ meterView.layout.margins = [2,0,2,0];
+
+ //setup a toggle button for each channel
+ this.setupPauseButton(meterView, config.at(\controls).at(name).at(\active));
+
+ // setup a small View as indicator for incoming/outgoing OSC messages for each input
+ this.setupOSCIndicator(meterView);
+ this.addOSCIndicatorFadeOutTask(name);
+
+ // setup LevelIndicator for each input
+ this.setupLevelIndicator(meterView);
+
+ controlsView = View(controlMeterContainerView.asView, Rect(0,0, controlsViewWidth, controlsViewHeight));
+ controlsView.asView.background = Color.fromHexString("#EEEFEE");
+ controlsView.name = \controls;
+ controlsView.layout = VLayout();
+ controlsView.layout.spacing = 0;
+ controlsView.layout.margins = [2,0,2,0];
+
+ //TODO: add ranger for amplitude and pitch threshold/region
+ //TODO: rearrange sliders/rangers/knobs in groups (maybe even tabs)
+ //Routine{
+ config.at(\controls).at(name).order.do({|control, i|
+ var value = config.at(\controls).at(name).at(control),
+ controlIs = BowelyzerConfig.controlContainedIn(control);
+ //(0.1).wait;
+ switch(
+ controlIs.asSymbol,
+ \knob, {this.setupEZKnob(controlsView, control, value, \controls, name).view.children.do({|item| if(item.isKindOf(NumberBox),{item.align_(\right)})})},
+ \slider, {this.setupEZSlider(controlsView, control, value).view.children.do({|item| if(item.isKindOf(NumberBox),{item.align_(\right)}); if(item.isKindOf(Slider), {item.orientation_(\horizontal)});})},
+ \ranger, {this.setupEZRanger(controlsView, control, value, \controls, name).view.children.do({|item| if(item.isKindOf(NumberBox),{item.align_(\right)})})}
+ );
});
- this.setupEZPopUpMenu(headView, "input", Server.default.options.numInputBusChannels, config.at(\inputs).at(name));
- this.setupChannelCloseButton(headView, name);
- }.play(AppClock);
-
- controlMeterContainerView = View(channelView.asView, Rect(0, 0, controlMeterContainerViewWidth, controlMeterContainerViewHeight));
- controlMeterContainerView.asView.background = Color.fromHexString("#DDDDEF");
- controlMeterContainerView.name = \meterAndControls;
- controlMeterContainerView.layout = HLayout();
- controlMeterContainerView.layout.spacing = 0;
- controlMeterContainerView.layout.margins = [0,0,0,0];
-
- meterView = View(controlMeterContainerView.asView, Rect(0,0, meterViewWidth, meterViewHeight));
- meterView.asView.background = Color.fromHexString("#EEEFEE");
- meterView.name = \meterView;
- meterView.layout = VLayout();
- meterView.maxWidth = meterViewWidth;
- meterView.layout.spacing = 0;
- meterView.layout.margins = [2,0,2,0];
-
- //setup a toggle button for each channel
- this.setupPauseButton(meterView, config.at(\controls).at(name).at(\active));
-
- // setup a small View as indicator for incoming/outgoing OSC messages for each input
- this.setupOSCIndicator(meterView);
- this.addOSCIndicatorFadeOutTask(name);
-
- // setup LevelIndicator for each input
- this.setupLevelIndicator(meterView);
-
- controlsView = View(controlMeterContainerView.asView, Rect(0,0, controlsViewWidth, controlsViewHeight));
- controlsView.asView.background = Color.fromHexString("#EEEFEE");
- controlsView.name = \controls;
- controlsView.layout = VLayout();
- controlsView.layout.spacing = 0;
- controlsView.layout.margins = [2,0,2,0];
-
- //TODO: add ranger for amplitude and pitch threshold/region
- //TODO: rearrange sliders/rangers/knobs in groups (maybe even tabs)
- //Routine{
- config.at(\controls).at(name).order.do({|control, i|
- var value = config.at(\controls).at(name).at(control),
- controlIs = BowelyzerConfig.controlContainedIn(control);
- //(0.1).wait;
- switch(
- controlIs.asSymbol,
- \knob, {this.setupEZKnob(controlsView, control, value, \controls, name).view.children.do({|item| if(item.isKindOf(NumberBox),{item.align_(\right)})})},
- \slider, {this.setupEZSlider(controlsView, control, value).view.children.do({|item| if(item.isKindOf(NumberBox),{item.align_(\right)}); if(item.isKindOf(Slider), {item.orientation_(\horizontal)});})},
- \ranger, {this.setupEZRanger(controlsView, control, value, \controls, name).view.children.do({|item| if(item.isKindOf(NumberBox),{item.align_(\right)})})}
- );
- });
- //}.play(AppClock);
- // add channelView to the container and the global Dictionary for better access
- channelContainerView.layout.add(channelView);
- channels.add(channelView);
+ //}.play(AppClock);
+ // add channelView to the container and the global Dictionary for better access
+ channelContainerView.layout.add(channelView);
+ channels.add(channelView);
+ }.defer;
+ }
+
+ // remove a channelView by name, resizing the enclosing channelContainerView to current amount of channels
+ removeChannelView{
+ arg name, channelSize;
+ {
+ channels.do({|channel,i|
+ if(channel.name == name.asString, {
+ channel.remove;
+ channels.remove(channel);
+ });
+ });
+ // resize the channelContainerView according to new amount of channels
+ channelContainerView.maxSize_(((channelViewWidth*channelSize)+buttonWidth)@channelViewHeight);
+ }.defer;
}
// setup a OSC indicator view (one on each channel)
@@ -329,26 +365,40 @@ BowelyzerGUI{
;
}
+ // ping an OSC indicator by name, restarting its fadeout Task
+ pingOSCIndicator{
+ arg name;
+ {
+ if(indicators.includesKey(name),{
+ indicators.at(name).stop;
+ indicators.at(name).reset;
+ indicators.at(name).start(AppClock);
+ });
+ }.defer;
+ }
+
// setup tasks for changing the OSC indicator color (on receiving a message)
addOSCIndicatorFadeOutTask{
arg name;
- indicators.put(
- name.asSymbol,
- Task({
- 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(View) && meterView.name.asSymbol == \OSCIndicator, {
- meterView.background_(Color.fromHexString("#99FF99"));
- fadeOutSteps.do({|item,i|
- meterView.background_(meterView.background.blend(Color.fromHexString("#EEEFEE"), (fadeOutTime/fadeOutSteps)));
- (fadeOutTime/fadeOutSteps).wait;
+ {
+ indicators.put(
+ name.asSymbol,
+ Task({
+ 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(View) && meterView.name.asSymbol == \OSCIndicator, {
+ meterView.background_(Color.fromHexString("#99FF99"));
+ fadeOutSteps.do({|item,i|
+ meterView.background_(meterView.background.blend(Color.fromHexString("#EEEFEE"), (fadeOutTime/fadeOutSteps)));
+ (fadeOutTime/fadeOutSteps).wait;
+ });
+ meterView.background_(Color.fromHexString("#EEEFEE"));
});
- meterView.background_(Color.fromHexString("#EEEFEE"));
});
});
});
@@ -356,20 +406,23 @@ BowelyzerGUI{
});
});
});
- });
- })
- );
+ })
+ );
+ }.defer;
}
// free an OSCIndicatorFadeOutTask by name
freeOSCIndicatorFadeOutTask{
arg name;
- if(indicators.includesKey(name.asSymbol), {
- indicators.at(name).stop;
- indicators.removeAt(name);
- });
+ {
+ if(indicators.includesKey(name.asSymbol), {
+ indicators.at(name).stop;
+ indicators.removeAt(name);
+ });
+ }.defer;
}
+ // setup a new LevelIndicator
setupLevelIndicator{
arg parent;
^LevelIndicator(
@@ -427,16 +480,18 @@ BowelyzerGUI{
arg controlUnit;
var address = NetAddr.new("127.0.0.1", NetAddr.langPort),
type = "/saveas";
- FileDialog.new(
- okFunc: {|path|
- postln("Sending: ["++type++", "++path++"]");
- address.sendMsg(type, path.asString);
- },
- cancelFunc: {},
- fileMode: 0,
- acceptMode: 1,
- stripResult: true
- );
+ {
+ FileDialog.new(
+ okFunc: {|path|
+ postln("Sending: ["++type++", "++path++"]");
+ address.sendMsg(type, path.asString);
+ },
+ cancelFunc: {},
+ fileMode: 0,
+ acceptMode: 1,
+ stripResult: true
+ );
+ }.defer;
}
// create a save button, that launches a FileDialog on press
@@ -721,16 +776,18 @@ BowelyzerGUI{
// set LevelIndicator values for given channel
setLevel{
arg name, level, peak;
- 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), {
- meterView.value = level;
- meterView.peakLevel = peak;
+ {
+ 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), {
+ meterView.value = level;
+ meterView.peakLevel = peak;
+ });
});
});
});
@@ -738,7 +795,7 @@ BowelyzerGUI{
});
});
});
- });
+ }.defer;
}
}