diff options
author | David Runge <dave@sleepmap.de> | 2016-07-10 18:11:16 +0200 |
---|---|---|
committer | David Runge <dave@sleepmap.de> | 2016-07-10 18:11:16 +0200 |
commit | 908abace18d669402f067276f1d995ca5b8ea6ba (patch) | |
tree | dfb649fbe829f547ff445825aeb9329b7377e77d | |
parent | ba885b3716e6180d3ac1d81049f0a2ebccd042fa (diff) | |
download | bowelyzer-908abace18d669402f067276f1d995ca5b8ea6ba.tar.gz bowelyzer-908abace18d669402f067276f1d995ca5b8ea6ba.tar.bz2 bowelyzer-908abace18d669402f067276f1d995ca5b8ea6ba.tar.xz bowelyzer-908abace18d669402f067276f1d995ca5b8ea6ba.zip |
classes/BowelyzerConfig.sc: Ordering the configuration file alphabetically.
-rw-r--r-- | classes/BowelyzerConfig.sc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/classes/BowelyzerConfig.sc b/classes/BowelyzerConfig.sc index 7f49865..69ee1d4 100644 --- a/classes/BowelyzerConfig.sc +++ b/classes/BowelyzerConfig.sc @@ -232,7 +232,6 @@ BowelyzerConfig{ }); } - //TODO: use order to sort the controls and inputs by name // write a valid JSON file from configuration writeConfigurationFile{ arg fileName; @@ -265,8 +264,9 @@ BowelyzerConfig{ currentInput = 0; configFile.write("{\n"); // global settings - config.pairsDo({|key, value| - if(key != \controls && key != \inputs, { + config.order.do({|key| + var value = config.at(key); + if((key != \controls) && (key != \inputs), { if(hasToBeString.includes(key), { configFile.write(" \""++key++"\": \""++value++"\",\n"); }); @@ -277,10 +277,11 @@ BowelyzerConfig{ }); // controls configFile.write(" \"controls\": {\n"); - config.at(\controls).pairsDo({|key, value| + config.at(\controls).order.do({|key| currentControlName = currentControlName+1; configFile.write(" \""++key++"\": {\n"); - value.pairsDo({|control, controlValue| + config.at(\controls).at(key).order.do({|control| + var controlValue = config.at(\controls).at(key).at(control); currentControl = currentControl+1; if(currentControl == controlsSize,{ configFile.write(" \""++control++"\": "++controlValue++"\n"); @@ -300,7 +301,8 @@ BowelyzerConfig{ configFile.write(" },\n"); // inputs configFile.write(" \"inputs\": {\n"); - config.at(\inputs).pairsDo({|key, value| + config.at(\inputs).order.do({|key| + var value = config.at(\inputs).at(key); currentInput = currentInput+1; if(currentInput == inputsSize,{ configFile.write(" \""++key++"\": "++value++"\n"); |