From feb51029a6e09775bef9a56e6dcc5c0d1c9402c6 Mon Sep 17 00:00:00 2001 From: David Runge Date: Sun, 24 Jul 2016 19:08:11 +0200 Subject: classes/Bowelyzer.sc: Extending the OSCdef for /controls to also handle controlValues with two values (RangeSlider values for example). Properly naming OSC message internals when listening for /controls (for readability). --- classes/Bowelyzer.sc | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'classes') diff --git a/classes/Bowelyzer.sc b/classes/Bowelyzer.sc index 1841cb7..f286587 100644 --- a/classes/Bowelyzer.sc +++ b/classes/Bowelyzer.sc @@ -36,12 +36,24 @@ Bowelyzer{ OSCdef.newMatching( key: \controls, func: {|msg, time, addr, recvPort| + var type = msg[0], + name = msg[1], + control = msg[2], + value = msg[3], + value2; postln("Received: "++msg); // if the control exists, change it - if(msg[1].notNil && msg[2].notNil && msg[3].notNil,{ - if(config.config.at(\controls).includesKey(msg[1]),{ - if(config.config.at(\controls).at(msg[1]).includesKey(msg[2]),{ - config.config.at(\controls).at(msg[1]).put(msg[2], config.getControlValue(msg[2], msg[3])); + if(name.notNil && control.notNil && value.notNil,{ + if(config.config.at(\controls).includesKey(name),{ + if(config.config.at(\controls).at(name).includesKey(control),{ + if(BowelyzerConfig.hasToBeArray.includes(control), { + if(msg[4].notNil, { + value2 = msg[4]; + config.config.at(\controls).at(name).put(control, config.getControlValue(control, [value, value2])); + }); + },{ + config.config.at(\controls).at(name).put(control, config.getControlValue(control, value)); + }); }); }); }); -- cgit v1.2.3-70-g09d2