From 59595414c7cb126f12fcdccb0d99300cfba49b2f Mon Sep 17 00:00:00 2001 From: David Runge Date: Sat, 9 Jul 2016 18:07:56 +0200 Subject: classes/BowelyzerConfig.sc: Moving the setting of configFilePath into readConfigurationFile (on success of reading and validating), as this makes outside calls less complicated. Adding the possibility of inserting predefined names, that are not nil, not empty and not yet included in the config, using addInput, instead of relying solely on uniqueIdentifiers. --- classes/BowelyzerConfig.sc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'classes') diff --git a/classes/BowelyzerConfig.sc b/classes/BowelyzerConfig.sc index b521203..3a3ebe6 100644 --- a/classes/BowelyzerConfig.sc +++ b/classes/BowelyzerConfig.sc @@ -98,8 +98,6 @@ BowelyzerConfig{ if(this.readConfigurationFile(configFile).not,{ error("Reading of configuration file failed. Using default."); config = defaultConfig; - },{ - configFilePath = configFile; }); },{ ("No configuration file provided. Using default.").postln; @@ -217,6 +215,7 @@ BowelyzerConfig{ postln("Reading of configuration complete. Now validating..."); if(this.validateConfig,{ postln("Validation complete."); + configFilePath = configFile; ^true; },{ postln("Validation failed."); @@ -414,10 +413,14 @@ BowelyzerConfig{ // add an input with standard controls to the config addInput{ - var name = this.createUniqueIdentifier; - config.at(\inputs).put(name, 0); + arg name; + var id = this.createUniqueIdentifier; + if((name.notNil && (name != "") && config.at(\inputs).includesKey(name).not), { + id = name; + }); + config.at(\inputs).put(id, 0); this.validateConfig; - ^name; + ^id; } // create a unique identifier of the form msg[number] -- cgit v1.2.3-70-g09d2