aboutsummaryrefslogtreecommitdiffstats
path: root/classes
diff options
context:
space:
mode:
authorDavid Runge <dave@sleepmap.de>2016-07-09 06:22:30 +0200
committerDavid Runge <dave@sleepmap.de>2016-07-09 06:22:30 +0200
commit8c1385e53c8c422b94e9f53a4c555e906a2564f2 (patch)
tree203167eaa4961e0c328c07657f7e396c884ea94e /classes
parent0ead8c750802a7924d8d68a8b20a3ccf93ef6979 (diff)
downloadbowelyzer-8c1385e53c8c422b94e9f53a4c555e906a2564f2.tar.gz
bowelyzer-8c1385e53c8c422b94e9f53a4c555e906a2564f2.tar.bz2
bowelyzer-8c1385e53c8c422b94e9f53a4c555e906a2564f2.tar.xz
bowelyzer-8c1385e53c8c422b94e9f53a4c555e906a2564f2.zip
classes/BowelyzerConfig.sc: Adding functions to add a single input channel with unique identifier (name). Updating comments and TODOs.
Diffstat (limited to 'classes')
-rw-r--r--classes/BowelyzerConfig.sc24
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: ");