diff options
-rw-r--r-- | BowelyzerConfig.sc | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/BowelyzerConfig.sc b/BowelyzerConfig.sc index 70672c9..7a45148 100644 --- a/BowelyzerConfig.sc +++ b/BowelyzerConfig.sc @@ -57,14 +57,14 @@ BowelyzerConfig{ \sendReplyFreq ]; + const <hasToBeBool = #[ + \active + ]; + var <config, <defaultConfig, <defaultControls, <changed = false; -// <hasToBeString, -// <hasToBeInteger, -// <hasToBeDictionary, -// <hasToBeFloat; *controlContainedIn{ arg control; @@ -101,6 +101,7 @@ BowelyzerConfig{ this.showConfig; } + // add ControlSpecs to the global Dictionary addControlSpecs{ ControlSpec.specs[\amplitudeAttackTime] = ControlSpec(0.001, 10, \lin, 0.001, 0.01, units: "s"); ControlSpec.specs[\amplitudeReleaseTime] = ControlSpec(0.001, 10, \lin, 0.001, 0.01, units: "s"); @@ -121,9 +122,10 @@ BowelyzerConfig{ ControlSpec.specs[\input] = ControlSpec(0, Server.default.options.numInputBusChannels-1, \lin, 1, 0, units: "channels"); } -// create the default configuration + // create the default configuration createDefaultConfig{ defaultControls = Dictionary.with(*[ + \active -> true, \amplitudeAttackTime -> 0.01, \amplitudeReleaseTime -> 0.1, \hfHainsworth -> 1.0, @@ -223,6 +225,8 @@ BowelyzerConfig{ }); } + //TODO: add writeConfigurationFile + // return a control value as correct type and within its defined ControlSpec range getControlValue{ arg control, value; @@ -233,6 +237,14 @@ BowelyzerConfig{ if(hasToBeInteger.includes(control.asSymbol),{ ^control.asSymbol.asSpec.constrain(value.asInteger).asInteger; }); + if(hasToBeBool.includes(control.asSymbol),{ + switch(value, + 0,{^false}, + 1,{^true}, + "true",{^true}, + "false",{^false} + ); + }); },{ ^nil; }); |