diff options
author | David Runge <dave@sleepmap.de> | 2016-06-22 02:04:19 +0200 |
---|---|---|
committer | David Runge <dave@sleepmap.de> | 2016-06-22 02:04:19 +0200 |
commit | fe06ccfb8d92caa775dcb029c67d887d28066141 (patch) | |
tree | bb2e73e4f5c2bd9cd9553e34db49560a2387e17d | |
parent | 6c9bc8fc9d882ddccd197c8eddf51f9e664b7723 (diff) | |
download | bowelyzer-fe06ccfb8d92caa775dcb029c67d887d28066141.tar.gz bowelyzer-fe06ccfb8d92caa775dcb029c67d887d28066141.tar.bz2 bowelyzer-fe06ccfb8d92caa775dcb029c67d887d28066141.tar.xz bowelyzer-fe06ccfb8d92caa775dcb029c67d887d28066141.zip |
BowelyzerOSCHub.sc: Renaming adding function for Synth listener. Creating start/stop/free functions for the OSCdefs. Moving the adding of a single Synth listener to a separate function, to be able to call it separately.
-rw-r--r-- | BowelyzerOSCHub.sc | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/BowelyzerOSCHub.sc b/BowelyzerOSCHub.sc index 4a7db26..7de5b72 100644 --- a/BowelyzerOSCHub.sc +++ b/BowelyzerOSCHub.sc @@ -15,7 +15,7 @@ BowelyzerOSCHub{ init{ arg config; this.setupNetAddressesFromConfig(config); - this.setupSynthListener(config); + this.setupSynthListenersFromConfig(config); } setupNetAddressesFromConfig{ @@ -25,23 +25,42 @@ BowelyzerOSCHub{ synthServer = BowelyzerOSCHub.getNetAddr(config.at(\synthServerAddress), config.at(\synthServerPort)); } -// setup OSCdef for SynthServerAddress:SynthServerPort - setupSynthListener{ + // setup OSCdef for SynthServerAddress:SynthServerPort + setupSynthListenersFromConfig{ arg config; // listen for individual SendReply messages config.at(\inputs).keysValuesDo({|name, input| postln("Listening for messages called '/"++name++"' coming from scsynth at "++synthServer.ip++":"++synthServer.port++"."); - OSCdef.newMatching( - name, - {|msg, time, addr, recvPort| this.forwardToNetAddress(msg, time)}, - name, - synthServer, - hub.port - ); - OSCdef(name).enable; + this.addSynthListener(name); }); } + addSynthListener{ + arg name; + OSCdef.newMatching( + name, + {|msg, time, addr, recvPort| this.forwardToNetAddress(msg, time)}, + name, + synthServer, + hub.port + ); + } + + startSynthListener{ + arg name; + OSCdef(name).enable; + } + + stopSynthListener{ + arg name; + OSCdef(name.asSymbol).disable; + } + + freeSynthListener{ + arg name; + OSCdef(name.asSymbol).free; + } + //forward a received OSC message to the globally specified forward address forwardToNetAddress{ arg msg, time; |