aboutsummaryrefslogtreecommitdiffstats
path: root/classes/Bowelyzer.sc
diff options
context:
space:
mode:
authorDavid Runge <dave@sleepmap.de>2016-07-25 02:47:30 +0200
committerDavid Runge <dave@sleepmap.de>2016-07-25 02:47:30 +0200
commit95962308af3cf8850736332591a19f6399c7ec28 (patch)
treeb4d0d8b843746d9137882e6fd4ac7122ea1cba6e /classes/Bowelyzer.sc
parentc4e9b7b33b80b509aca52f9df5d6021038efab77 (diff)
downloadbowelyzer-95962308af3cf8850736332591a19f6399c7ec28.tar.gz
bowelyzer-95962308af3cf8850736332591a19f6399c7ec28.tar.bz2
bowelyzer-95962308af3cf8850736332591a19f6399c7ec28.tar.xz
bowelyzer-95962308af3cf8850736332591a19f6399c7ec28.zip
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.
Diffstat (limited to 'classes/Bowelyzer.sc')
-rw-r--r--classes/Bowelyzer.sc17
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);
});
+ });
});
});
}