From 95962308af3cf8850736332591a19f6399c7ec28 Mon Sep 17 00:00:00 2001 From: David Runge Date: Mon, 25 Jul 2016 02:47:30 +0200 Subject: classes/Bowelyzer.sc: Adding the forwarding of OSC messages per channels depending on config \onlyForwardOnNewPitch to the forwardToNetAddress function. Much of it will have to be moved back to the OSCdef function again to decrease code reduncancy. --- classes/Bowelyzer.sc | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'classes') diff --git a/classes/Bowelyzer.sc b/classes/Bowelyzer.sc index 98817fe..7f75720 100644 --- a/classes/Bowelyzer.sc +++ b/classes/Bowelyzer.sc @@ -460,21 +460,34 @@ Bowelyzer{ forwardToNetAddress{ arg msg, time; var name = msg[0], + sanitizedName = name.asString.replace("/","").asSymbol, amplitude = msg[3], pitch = msg[4], hasPitch = msg[5], onsetDetect = msg[6], - range = config.config.at(\controls).at(name.asString.replace("/","").asSymbol).at(\freqRange); + range = config.config.at(\controls).at(sanitizedName).at(\freqRange), + onlyForwardOnNewPitch = config.config.at(\controls).at(sanitizedName).at(\onlyForwardOnNewPitch); // if there is something connected if(amplitude != 0,{ // if the pitch is within freqRange if((pitch >= range[0]) && (pitch <= range[1]),{ - localAddr.sendMsg("/indicate", name.asString.replace("/","").asSymbol); + if(onlyForwardOnNewPitch, { + if(hasPitch > 0, { + localAddr.sendMsg("/indicate", sanitizedName); + if(forwardAddr.isLocal && (forwardAddr.port == NetAddr.langPort), { + postln(name++": amplitude: "++amplitude++"; pitch: "++pitch++"; hasPitch: "++hasPitch++"; onSet: "++onsetDetect); + },{ + forwardAddr.sendMsg(name, amplitude, pitch, hasPitch, onsetDetect); + }); + }); + },{ + localAddr.sendMsg("/indicate", sanitizedName); if(forwardAddr.isLocal && (forwardAddr.port == NetAddr.langPort), { postln(name++": amplitude: "++amplitude++"; pitch: "++pitch++"; hasPitch: "++hasPitch++"; onSet: "++onsetDetect); },{ forwardAddr.sendMsg(name, amplitude, pitch, hasPitch, onsetDetect); }); + }); }); }); } -- cgit v1.2.3-70-g09d2