diff options
author | David Runge <dave@sleepmap.de> | 2016-06-30 12:57:19 +0200 |
---|---|---|
committer | David Runge <dave@sleepmap.de> | 2016-06-30 12:57:19 +0200 |
commit | ca9d41147d1a0672e520c1d43c904d62cf3803d8 (patch) | |
tree | 543687c6eaa61e7b4eb0e9ce337a391b699e1684 /BowelyzerConfig.sc | |
parent | 36e2e68a600025de77f96161be2dd73aedc29f28 (diff) | |
download | bowelyzer-ca9d41147d1a0672e520c1d43c904d62cf3803d8.tar.gz bowelyzer-ca9d41147d1a0672e520c1d43c904d62cf3803d8.tar.bz2 bowelyzer-ca9d41147d1a0672e520c1d43c904d62cf3803d8.tar.xz bowelyzer-ca9d41147d1a0672e520c1d43c904d62cf3803d8.zip |
BowelyzerConfig.sc: Extending the controls by an \active flag, indicating whether the input is supposed to be running when initialized. Adding hasToBeBool check and extenting getControlValue by it. Adding TODO for writeConfigurationFile. Removing useless comments. Cleaning up comments.
Diffstat (limited to 'BowelyzerConfig.sc')
-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; }); |