diff options
-rw-r--r-- | classes/Bowelyzer.sc | 17 |
1 files changed, 15 insertions, 2 deletions
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); }); + }); }); }); } |