diff options
Diffstat (limited to 'classes')
-rw-r--r-- | classes/BowelyzerConfig.sc | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/classes/BowelyzerConfig.sc b/classes/BowelyzerConfig.sc index 1a4ce87..b521203 100644 --- a/classes/BowelyzerConfig.sc +++ b/classes/BowelyzerConfig.sc @@ -170,7 +170,7 @@ BowelyzerConfig{ ]); } -// read configuration from file + // read configuration from file readConfigurationFile{ arg configFile; var configFromFile, reader, path; @@ -233,6 +233,7 @@ BowelyzerConfig{ }); } + //TODO: use order to sort the controls and inputs by name // write a valid JSON file from configuration writeConfigurationFile{ arg fileName; @@ -411,6 +412,27 @@ BowelyzerConfig{ ^true; } + // add an input with standard controls to the config + addInput{ + var name = this.createUniqueIdentifier; + config.at(\inputs).put(name, 0); + this.validateConfig; + ^name; + } + + // create a unique identifier of the form msg[number] + createUniqueIdentifier{ + var msg = \msg1, + iterator = 0; + while({ + config.at(\inputs).includesKey(msg) + },{ + iterator = (msg.asString.replace("msg", "").asInteger) + 1; + msg = ("msg"++iterator).asSymbol; + }); + ^msg.asSymbol; + } + //print the current config showConfig{ postln("Configuration is: "); |