aboutsummaryrefslogtreecommitdiffstats
path: root/classes/Bowelyzer.sc
diff options
context:
space:
mode:
authorDavid Runge <dave@sleepmap.de>2016-07-10 19:21:31 +0200
committerDavid Runge <dave@sleepmap.de>2016-07-10 19:21:31 +0200
commit393dde90a4b7f3cdabf8b704057c0f8ea2982ca0 (patch)
tree10e14013df68e84fa30cab2bf95a1127dd8b2f3f /classes/Bowelyzer.sc
parent0d0d4c017c8e9b02a7a924b331838f538397d2bb (diff)
downloadbowelyzer-393dde90a4b7f3cdabf8b704057c0f8ea2982ca0.tar.gz
bowelyzer-393dde90a4b7f3cdabf8b704057c0f8ea2982ca0.tar.bz2
bowelyzer-393dde90a4b7f3cdabf8b704057c0f8ea2982ca0.tar.xz
bowelyzer-393dde90a4b7f3cdabf8b704057c0f8ea2982ca0.zip
classes/Bowelyzer.sc: Adding support for rename prevention, if the name is already used or empty. Adding TODOs for refactoring of functionalities.
Diffstat (limited to 'classes/Bowelyzer.sc')
-rw-r--r--classes/Bowelyzer.sc12
1 files changed, 9 insertions, 3 deletions
diff --git a/classes/Bowelyzer.sc b/classes/Bowelyzer.sc
index 3a61618..a877a89 100644
--- a/classes/Bowelyzer.sc
+++ b/classes/Bowelyzer.sc
@@ -62,15 +62,15 @@ Bowelyzer{
if(config.config.at(\inputs).includesKey(name) && config.config.at(\controls).includesKey(name),{
switch(type,
\name,{
- //if the name exists and the new name is not empty, change it
- //FIXME: check whether new name exists and only setup then, else reset the textfield
- if(update != "",{
+ // if the name is not empty and not used, change to it
+ if((update != "") && config.config.at(\inputs).includesKey(update).not, {
//move the controls
config.config.at(\controls).put(update.asSymbol, config.config.at(\controls).at(name));
config.config.at(\controls).removeAt(name.asSymbol);
// rename the input
config.config.at(\inputs).put(update.asSymbol, config.config.at(\inputs).at(name));
config.config.at(\inputs).removeAt(name);
+ //TODO: refactor into gui function
Routine{
// rename the channel View
gui.channels.do({|channel|
@@ -86,19 +86,25 @@ Bowelyzer{
// stop the listener for LevelIndicator by name and start a new one based upon the updated name
OSCdef(("levels_"++name).asSymbol).free;
this.setupLevelListener(update, hub.synthServer);
+ //TODO: refactor into function
// free the synth on the server and start a new one according to the config
analyzer.freeAnalysisSynth(name.asSymbol);
analyzer.synths.removeAt(name);
+ //TODO: refactor into function
analyzer.addSynthWithName(update);
// start the Synth (possibly paused)
Routine{
1.wait;
analyzer.startSynthWithNameAndControls(update.asSymbol, config.config.at(\controls).at(update), config.config.at(\inputs).at(update));
}.play;
+ //TODO: refactor into function
// rename the hub listener for the Synth
hub.freeSynthListener(name);
hub.addSynthListener(update);
hub.startSynthListener(update);
+ },{
+ ("New name not valid: "++update).error;
+ gui.setChannelName(name, name);
});
},
\input,{