diff options
author | David Runge <dave@sleepmap.de> | 2016-07-02 02:33:12 +0200 |
---|---|---|
committer | David Runge <dave@sleepmap.de> | 2016-07-02 02:33:12 +0200 |
commit | 02c3e4d4a429e4fae0ad915c7335e1897117a977 (patch) | |
tree | 687ae1405e0bde85816e45044417bcb5104038ff | |
parent | 1457dffcf11574f6464cb8f808ad32c4d408f570 (diff) | |
download | bowelyzer-02c3e4d4a429e4fae0ad915c7335e1897117a977.tar.gz bowelyzer-02c3e4d4a429e4fae0ad915c7335e1897117a977.tar.bz2 bowelyzer-02c3e4d4a429e4fae0ad915c7335e1897117a977.tar.xz bowelyzer-02c3e4d4a429e4fae0ad915c7335e1897117a977.zip |
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.
-rw-r--r-- | Bowelyzer.sc | 58 |
1 files changed, 58 insertions, 0 deletions
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 |