aboutsummaryrefslogtreecommitdiffstats
path: root/classes/BowelyzerOSCHub.sc
diff options
context:
space:
mode:
authorDavid Runge <dave@sleepmap.de>2016-07-24 20:03:20 +0200
committerDavid Runge <dave@sleepmap.de>2016-07-24 20:03:20 +0200
commit0baf487757f5332052db36f5d5a34d5e5b0cfb40 (patch)
treedde565851325646c9b1d98bd14caf076a7b18644 /classes/BowelyzerOSCHub.sc
parent419ec811180089ed5db4cc3dbd9a5425d8496279 (diff)
downloadbowelyzer-0baf487757f5332052db36f5d5a34d5e5b0cfb40.tar.gz
bowelyzer-0baf487757f5332052db36f5d5a34d5e5b0cfb40.tar.bz2
bowelyzer-0baf487757f5332052db36f5d5a34d5e5b0cfb40.tar.xz
bowelyzer-0baf487757f5332052db36f5d5a34d5e5b0cfb40.zip
classes/BowelyzerOSCHub.sc: Removing class, as it's now merged into the main Bowelyzer.sc class.
Diffstat (limited to 'classes/BowelyzerOSCHub.sc')
-rw-r--r--classes/BowelyzerOSCHub.sc90
1 files changed, 0 insertions, 90 deletions
diff --git a/classes/BowelyzerOSCHub.sc b/classes/BowelyzerOSCHub.sc
deleted file mode 100644
index 9144333..0000000
--- a/classes/BowelyzerOSCHub.sc
+++ /dev/null
@@ -1,90 +0,0 @@
-BowelyzerOSCHub{
- var <hub, <forward, <synthServer, <local;
-
- *new{
- arg config;
- ^super.new.init(config);
- }
-
- // setup a NetAddr object and return it
- *getNetAddr{
- arg server, port;
- ^NetAddr.new(server, port);
- }
-
- init{
- arg config;
- this.setupNetAddressesFromConfig(config);
- this.setupSynthListenersFromConfig(config);
- }
-
- // setup the NetAddresses from configuration
- setupNetAddressesFromConfig{
- arg config;
- forward = BowelyzerOSCHub.getNetAddr(config.at(\forwardAddress), config.at(\forwardPort));
- hub = BowelyzerOSCHub.getNetAddr(config.at(\hubAddress), config.at(\hubPort));
- synthServer = BowelyzerOSCHub.getNetAddr(config.at(\synthServerAddress), config.at(\synthServerPort));
- local = NetAddr.new("127.0.0.1", NetAddr.langPort);
- }
-
- // 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++".");
- this.addSynthListener(name);
- });
- }
-
- // add a listener for a specific Synth (by name)
- addSynthListener{
- arg name;
- OSCdef.newMatching(
- key: name.asSymbol,
- func: {|msg, time, addr, recvPort|
- this.forwardToNetAddress(msg, time);
- },
- path: "/"++name.asString,
- srcID: synthServer,
- recvPort: 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;
- var name = msg[0],
- amplitude = msg[3],
- pitch = msg[4],
- hasPitch = msg[5],
- onsetDetect = msg[6];
- if(amplitude != 0,{
- local.sendMsg("/indicate", msg[0].asString.replace("/","").asSymbol);
- if(forward.isLocal && (forward.port == NetAddr.langPort), {
- postln(msg[0]++": amplitude: "++amplitude++"; pitch: "++pitch++"; hasPitch: "++hasPitch++"; onSet: "++onsetDetect);
- },{
- forward.sendMsg(name, amplitude, pitch, hasPitch, onsetDetect);
- });
- });
- }
-
- //TODO: add functions to modify OSC listener behavior (what data to send from which channel)
-
-}
-