From 02c3e4d4a429e4fae0ad915c7335e1897117a977 Mon Sep 17 00:00:00 2001 From: David Runge Date: Sat, 2 Jul 2016 02:33:12 +0200 Subject: Bowelyzer.sc: Implementing OSCdef listener for address, port, save and load. The two latter still need further extensions in BowelyzerConfig and Bowelyzer to actually do anything. --- Bowelyzer.sc | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/Bowelyzer.sc b/Bowelyzer.sc index 85a6edc..450296c 100644 --- a/Bowelyzer.sc +++ b/Bowelyzer.sc @@ -136,6 +136,64 @@ Bowelyzer{ path: "/toggle", srcID: NetAddr.new("127.0.0.1", NetAddr.langPort) ); + + // listen for address messages to change OSC addresses + OSCdef.newMatching( + key: \address, + func: {|msg, time, addr, recvPort| + var type = msg[1], + address = msg[2]; + postln("Received: "++msg); + if(type.notNil && config.config.includesKey(type),{ + config.config.put(type.asSymbol, address.asString); + hub.setupNetAddressesFromConfig(config.config); + }); + }, + path: "/address", + srcID: hub.local + ); + + // listen for port messages to change OSC ports + OSCdef.newMatching( + key: \port, + func: {|msg, time, addr, recvPort| + var type = msg[1], + port = msg[2]; + postln("Received: "++msg); + if(type.notNil && config.config.includesKey(type),{ + config.config.put(type.asSymbol, port.asInteger); + hub.setupNetAddressesFromConfig(config.config); + }); + }, + path: "/port", + srcID: hub.local + ); + + // listen for port messages to change OSC ports + OSCdef.newMatching( + key: \save, + func: {|msg, time, addr, recvPort| + var path = msg[1]; + postln("Received: "++msg); + //TODO: implement save (write to file) in BowelyzerConfig + }, + path: "/save", + srcID: hub.local + ); + + // listen for port messages to change OSC ports + OSCdef.newMatching( + key: \load, + func: {|msg, time, addr, recvPort| + var path = msg[1]; + postln("Received: "++msg); + //TODO: use BowelyzerConfig readFromConfigurationFile + //TODO: destroy current GUI elements + //TODO: load channels, etc. + }, + path: "/load", + srcID: hub.local + ); } // add OSCdefs listening for messages coming from scsynth, to update the GUI -- cgit v1.2.3-70-g09d2