From fa90a9232880c77ecc759751ce9828878cab243d Mon Sep 17 00:00:00 2001 From: David Runge Date: Wed, 29 Jun 2016 21:02:14 +0200 Subject: BowelyzerOSCHub.sc: Adding the the indicator messaging to the forward function. Properly checking if there's actually any audio coming in on the specified channel. If not, don't send any OSC messages. --- BowelyzerOSCHub.sc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/BowelyzerOSCHub.sc b/BowelyzerOSCHub.sc index 14ec940..ba3a9c9 100644 --- a/BowelyzerOSCHub.sc +++ b/BowelyzerOSCHub.sc @@ -41,7 +41,6 @@ BowelyzerOSCHub{ OSCdef.newMatching( name, {|msg, time, addr, recvPort| - local.sendMsg("/indicate", msg[0].asString.replace("/","").asSymbol); this.forwardToNetAddress(msg, time); }, name, @@ -73,10 +72,13 @@ BowelyzerOSCHub{ pitch = msg[4], hasPitch = msg[5], onsetDetect = msg[7]; - if(forward.isLocal && (forward.port == NetAddr.langPort), { - postln(msg[0]++" (amplitude: "++amplitude++"; pitch: "++pitch++"; has pitch: "++hasPitch); - },{ - forward.sendMsg(name,"/amplitude", amplitude, "/pitch", pitch, "/hasPitch", hasPitch, "/detect", onsetDetect); + 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++"; has pitch: "++hasPitch); + },{ + forward.sendMsg(name,"/amplitude", amplitude, "/pitch", pitch, "/hasPitch", hasPitch, "/detect", onsetDetect); + }); }); } -- cgit v1.2.3-54-g00ecf