aboutsummaryrefslogtreecommitdiffstats
path: root/BowelyzerOSCHub.sc
diff options
context:
space:
mode:
authorDavid Runge <dave@sleepmap.de>2016-05-29 13:38:07 +0200
committerDavid Runge <dave@sleepmap.de>2016-05-29 13:38:07 +0200
commit74bb3e3290d8f4ea82b2caf79f4b96bb7991faad (patch)
tree2da93c9e1923893ec752108733397204821e273d /BowelyzerOSCHub.sc
parent33d8b5bff1feb3c35fc049e29fcaca985d50520b (diff)
downloadbowelyzer-74bb3e3290d8f4ea82b2caf79f4b96bb7991faad.tar.gz
bowelyzer-74bb3e3290d8f4ea82b2caf79f4b96bb7991faad.tar.bz2
bowelyzer-74bb3e3290d8f4ea82b2caf79f4b96bb7991faad.tar.xz
bowelyzer-74bb3e3290d8f4ea82b2caf79f4b96bb7991faad.zip
First commit of bowelyzer code. Includes Bowelyzer.sc, Bowelyzer{Analyzer,Config,OSCHub}.sc, bowelyzer.scd (for help) and darmstadt.json for a standard configuration in JSON.
Diffstat (limited to 'BowelyzerOSCHub.sc')
-rw-r--r--BowelyzerOSCHub.sc47
1 files changed, 47 insertions, 0 deletions
diff --git a/BowelyzerOSCHub.sc b/BowelyzerOSCHub.sc
new file mode 100644
index 0000000..028de55
--- /dev/null
+++ b/BowelyzerOSCHub.sc
@@ -0,0 +1,47 @@
+BowelyzerOSCHub{
+ var <>config, <hub, <forward, <synthServer, <synthServerListener;
+
+ *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.config = 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"));
+ this.addAnalysisListener;
+ }
+
+
+// setup a new listener for SynthServerAddress:SynthServerPort
+ addAnalysisListener{
+ // listen for individual SendReply messages
+ config.at("names").do({|name|
+ postln("Listening for messages called '/"++name++"' coming from scsynth.");
+ //TODO: use OSCdef here to be able to use key and free
+ synthServerListener = OSCFunc.newMatching(
+ {|msg, time, addr, recvPort|
+ postln(time.asString++": "++msg[0]++" (amplitude: "++msg[3]++"; pitch: "++msg[4]++"; has pitch: "++msg[5]++"; note on: "++msg[6]++")");
+ if(msg[6] != 0.0,{
+ postln(msg[0]++" (amplitude: "++msg[3]++"; pitch: "++msg[4]++"; has pitch: "++msg[5]);
+ });
+ },
+ '/'++name.asSymbol,
+ synthServer,
+ hub.port
+ );
+ });
+ }
+
+ //TODO: add functions to set arguments for analyzer synths generically
+
+} \ No newline at end of file