diff options
-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"); |