aboutsummaryrefslogtreecommitdiffstats
path: root/classes/BowelyzerGUI.sc
diff options
context:
space:
mode:
Diffstat (limited to 'classes/BowelyzerGUI.sc')
-rw-r--r--classes/BowelyzerGUI.sc93
1 files changed, 82 insertions, 11 deletions
diff --git a/classes/BowelyzerGUI.sc b/classes/BowelyzerGUI.sc
index 675e100..ad4507c 100644
--- a/classes/BowelyzerGUI.sc
+++ b/classes/BowelyzerGUI.sc
@@ -8,8 +8,8 @@ BowelyzerGUI{
fadeOutSteps = 20,
minWidth=1280,
minHeight=720,
- channelViewHeight = 700,
- channelViewWidth = 300,
+ <channelViewHeight = 700,
+ <channelViewWidth = 300,
channelViewSize,
controlMeterContainerViewHeight = 700,
controlMeterContainerViewWidth = 300,
@@ -54,6 +54,12 @@ BowelyzerGUI{
mainView = PageLayout.new("Bowelyzer");
mainView.asView.background = Color.fromHexString("#DBDBDB");
layout = mainView.asView.addFlowLayout(0@0, 0@0);
+ mainView.onClose_({
+ |view|
+ view.close;
+ });
+
+ //settings
settingsView = View(mainView.asView, Rect(0, 0, settingsViewSize.x, settingsViewSize.y));
settingsView.asView.background = Color.fromHexString("#99EF99");
settingsView.layout = HLayout();
@@ -135,6 +141,8 @@ BowelyzerGUI{
channelContainerView.layout = HLayout();
channelContainerView.layout.spacing = 0;
channelContainerView.layout.margins = [0,0,0,0];
+ channelContainerView.name = \channelContainerView;
+ //channelContainerView.minSize_(channelViewWidth@channelViewHeight);
channelContainerView.maxSize_((channelViewWidth*config.at(\inputs).size)@channelViewHeight);
}
@@ -143,14 +151,15 @@ BowelyzerGUI{
arg config;
var channelView, headView, controlMeterContainerView, meterView, controlsView, controlsFromConfig, levelIndicator;
config.at(\inputs).keysValuesDo({|name, input|
- //channelView = View(mainView.asView, Rect(0, 0, mainView.bounds.width/config.at(\inputs).size, mainView.bounds.height));
channelView = View(mainView.asView, Rect(0, 0, channelViewWidth, channelViewHeight));
channelView.asView.background = Color.fromHexString("#FEEFEF");
- channelView.name = name;
+ channelView.name = name.asString;
channelView.layout = VLayout();
channelView.layout.spacing = 0;
channelView.layout.margins = [2,0,2,0];
channelView.maxSize_(300@700);
+ channelView.deleteOnClose_(true);
+
// adding name textfield of input
headView = View(channelView.asView, Rect(0, 0, headViewWidth, headViewHeight));
headView.asView.background = Color.fromHexString("#DDEFDD");
@@ -164,9 +173,10 @@ BowelyzerGUI{
if(item.isKindOf(TextField),{item.align_(\right)});
});
this.setupEZNumber(headView, "input", config.at(\inputs).at(name)).children.do({|item|
- item.postln; if(item.isKindOf(StaticText),{item.align_(\left)});
- item.postln; if(item.isKindOf(NumberBox),{item.align_(\right)});
+ if(item.isKindOf(StaticText),{item.align_(\left)});
+ if(item.isKindOf(NumberBox),{item.align_(\right)});
});
+ this.setupChannelCloseButton(headView, name);
controlMeterContainerView = View(channelView.asView, Rect(0, 0, controlMeterContainerViewWidth, controlMeterContainerViewHeight));
controlMeterContainerView.asView.background = Color.fromHexString("#DDDDEF");
@@ -262,8 +272,13 @@ BowelyzerGUI{
);
}
+ // free an OSCIndicatorFadeOutTask by name
freeOSCIndicatorFadeOutTask{
-
+ arg name;
+ if(indicators.includesKey(name.asSymbol), {
+ indicators.at(name).stop;
+ indicators.removeAt(name);
+ });
}
setupLevelIndicator{
@@ -271,7 +286,6 @@ BowelyzerGUI{
^LevelIndicator(
parent
).maxSize_(buttonWidth@600)
- .style_(\led)
.drawsPeak_(true);
}
@@ -366,6 +380,25 @@ BowelyzerGUI{
;
}
+ // setup a button to free (close) a channel
+ setupChannelCloseButton{
+ arg parent, name;
+ ^Button(parent, Rect(0, 0, buttonHeight, buttonHeight))
+ .states_([
+ ["X", Color.black, Color.fromHexString("#FF9999")]
+ ])
+ .action_({
+ arg controlUnit;
+ var address = NetAddr.new("127.0.0.1", NetAddr.langPort),
+ type = "/free";
+ postln("Sending: ["++type++", "++name++"]");
+ address.sendMsg(type, name);
+ })
+ .maxSize_(buttonHeight@buttonHeight)
+ .name_("close")
+ ;
+ }
+
// setup a StaticText and a TextField
setupEZText{
arg parent, control, value;
@@ -378,6 +411,10 @@ BowelyzerGUI{
labelWidth = 60;
textWidth = 80;
});
+ if(control == "name", {
+ bounds = 140@buttonHeight;
+ textWidth = 84;
+ });
^EZText(
parent: parent,
bounds: bounds,
@@ -406,6 +443,7 @@ BowelyzerGUI{
margin: nil
)
.view.maxHeight_(buttonHeight)
+ .asView.name_(control)
;
}
@@ -421,6 +459,11 @@ BowelyzerGUI{
labelWidth = 70;
numberWidth = 70;
});
+ if(control == "input", {
+ bounds = 124@buttonHeight;
+ labelWidth = 48;
+ numberWidth = 76;
+ });
^EZNumber(
parent: parent,
bounds: bounds,
@@ -450,6 +493,7 @@ BowelyzerGUI{
margin: nil
)
.view.maxHeight_(buttonHeight)
+ .asView.name_(control)
;
}
@@ -473,7 +517,8 @@ BowelyzerGUI{
numberWidth: 70,
layout: \line2,
margin: nil
- );
+ )
+ ;
}
setupEZRanger{
@@ -494,7 +539,8 @@ BowelyzerGUI{
},
labelWidth: 120,
unitWidth:30
- );
+ )
+ ;
}
setupEZKnob{
@@ -515,7 +561,32 @@ BowelyzerGUI{
},
labelWidth: 120,
unitWidth:30
- );
+ )
+ ;
}
+
+ // 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;
+ });
+ });
+ });
+ });
+ });
+ });
+ });
+ });
+ }
+
}