bufthresh and bufscale now with verbose parameter names (and corrected an error in the examples of the latter)

nix
Pierre Alexandre Tremblay 5 years ago
parent b6fdc78d12
commit c663657c72

@ -1,31 +1,31 @@
FluidBufScale : UGen { FluidBufScale : UGen {
*new1 { |rate, source, destination, inlo, inhi, outlo, outhi, trig = 1, blocking| *new1 { |rate, source, destination, inputLow, inputHigh, outputLow, outputHigh, trig = 1, blocking|
source = source.asUGenInput; source = source.asUGenInput;
destination = destination.asUGenInput; destination = destination.asUGenInput;
source.isNil.if {"FluidBufScale: Invalid source buffer".throw}; source.isNil.if {"FluidBufScale: Invalid source buffer".throw};
destination.isNil.if {"FluidBufScale: Invalid destination buffer".throw}; destination.isNil.if {"FluidBufScale: Invalid destination buffer".throw};
^super.new1(rate, source, destination, inlo, inhi, outlo, outhi, trig, blocking); ^super.new1(rate, source, destination, inputLow, inputHigh, outputLow, outputHigh, trig, blocking);
} }
*kr { |source, destination, inlo = 0 , inhi = 1, outlo = 0, outhi = 1, trig = 1, blocking = 1| *kr { |source, destination, inputLow = 0 , inputHigh = 1, outputLow = 0, outputHigh = 1, trig = 1, blocking = 1|
^this.new1('control', source, destination, inlo, inhi, outlo, outhi, trig, blocking); ^this.new1('control', source, destination, inputLow, inputHigh, outputLow, outputHigh, trig, blocking);
} }
*process { |server, source, destination, inlo = 0 , inhi = 1, outlo = 0, outhi = 1, action| *process { |server, source, destination, inputLow = 0 , inputHigh = 1, outputLow = 0, outputHigh = 1, action|
^FluidNRTProcess.new( ^FluidNRTProcess.new(
server, this, action, [destination], blocking:1 server, this, action, [destination], blocking:1
).process( ).process(
source, destination, inlo, inhi, outlo, outhi source, destination, inputLow, inputHigh, outputLow, outputHigh
); );
} }
*processBlocking { |server, source, destination, inlo = 0 , inhi = 1, outlo = 0 , outhi = 1, action| *processBlocking { |server, source, destination, inputLow = 0 , inputHigh = 1, outputLow = 0 , outputHigh = 1, action|
^process( ^process(
source, destination, inlo, inhi, outlo, outhi source, destination, inputLow, inputHigh, outputLow, outputHigh
); );
} }
} }

@ -1,31 +1,31 @@
FluidBufThresh : UGen { FluidBufThresh : UGen {
*new1 { |rate, source, destination, thresh = 0, trig = 1, blocking| *new1 { |rate, source, destination, threshold = 0, trig = 1, blocking|
source = source.asUGenInput; source = source.asUGenInput;
destination = destination.asUGenInput; destination = destination.asUGenInput;
source.isNil.if {"FluidBufThresh: Invalid source buffer".throw}; source.isNil.if {"FluidBufThresh: Invalid source buffer".throw};
destination.isNil.if {"FluidBufThresh: Invalid destination buffer".throw}; destination.isNil.if {"FluidBufThresh: Invalid destination buffer".throw};
^super.new1(rate, source, destination, thresh, trig, blocking); ^super.new1(rate, source, destination, threshold, trig, blocking);
} }
*kr { |source, destination, thresh = 0, trig = 1, blocking = 1| *kr { |source, destination, threshold = 0, trig = 1, blocking = 1|
^this.new1('control', source, destination, thresh, trig, blocking); ^this.new1('control', source, destination, threshold, trig, blocking);
} }
*process { |server, source, destination, thresh = 0, action| *process { |server, source, destination, threshold = 0, action|
^FluidNRTProcess.new( ^FluidNRTProcess.new(
server, this, action, [destination], blocking:1 server, this, action, [destination], blocking:1
).process( ).process(
source, destination, thresh source, destination, threshold
); );
} }
*processBlocking { |server, source, destination, thresh = 0, action| *processBlocking { |server, source, destination, threshold = 0, action|
^process( ^process(
source, destination, thresh source, destination, threshold
); );
} }
} }

@ -3,7 +3,7 @@ SUMMARY:: A Scaling Processor for Buffers
CATEGORIES:: Libraries>FluidDecomposition CATEGORIES:: Libraries>FluidDecomposition
RELATED:: Guides/FluCoMa, Guides/FluidDecomposition, Guides/FluidBufMultiThreading RELATED:: Guides/FluCoMa, Guides/FluidDecomposition, Guides/FluidBufMultiThreading
This class implements a simple Buffer preprocessor, by scaling its values. It draws a simple translation from inlo to outlo, and from inhi to outhi. It is part of the LINK:: Guides/FluidDecomposition:: of LINK:: Guides/FluCoMa::. For more explanations, learning material, and discussions on its musicianly uses, visit http://www.flucoma.org/ This class implements a simple Buffer preprocessor, by scaling its values. It draws a simple translation from inputLow to outputLow, and from inputHigh to outputHigh. It is part of the LINK:: Guides/FluidDecomposition:: of LINK:: Guides/FluCoMa::. For more explanations, learning material, and discussions on its musicianly uses, visit http://www.flucoma.org/
The process will return a buffer with the same size and shape than the original. The process will return a buffer with the same size and shape than the original.
@ -25,17 +25,17 @@ The index of the buffer to use as the source material to be processed.
ARGUMENT:: destination ARGUMENT:: destination
The index of the buffer to use as the destination for the processed material. The index of the buffer to use as the destination for the processed material.
ARGUMENT:: inlo ARGUMENT:: inputLow
the low reference point of the input. it will be scaled to yield outlo at the output the low reference point of the input. it will be scaled to yield outputLow at the output
ARGUMENT:: inhi ARGUMENT:: inputHigh
the high reference point of the input. it will be scaled to yield outhi at the output the high reference point of the input. it will be scaled to yield outputHigh at the output
ARGUMENT:: outlo ARGUMENT:: outputLow
the output value when the input is inlo the output value when the input is inputLow
ARGUMENT:: outhi ARGUMENT:: outputHigh
the output value whenthe input is inhi the output value whenthe input is inputHigh
ARGUMENT:: action ARGUMENT:: action
A Function to be evaluated once the offline process has finished and indices instance variables have been updated on the client side. The metric will be passed indices as an argument. A Function to be evaluated once the offline process has finished and indices instance variables have been updated on the client side. The metric will be passed indices as an argument.
@ -51,7 +51,7 @@ code::
b = Buffer.sendCollection(s,0.0.series(0.1,1.0)) b = Buffer.sendCollection(s,0.0.series(0.1,1.0))
// and a destination buffer // and a destination buffer
c = Buffer(s) c = Buffer(s)
// play with the threshold // play with the scaling
FluidBufScale.process(s,b,c,0,1,20,10) FluidBufScale.process(s,b,c,0,1,20,10)
// retrieve the buffer and enjoy the results. // retrieve the buffer and enjoy the results.
c.getn(0,11,{|x|x.postln;}) c.getn(0,11,{|x|x.postln;})
@ -59,8 +59,8 @@ c.getn(0,11,{|x|x.postln;})
// also works in multichannel - explore the following buffer // also works in multichannel - explore the following buffer
b = Buffer.sendCollection(s,-10.0.series(-9,10.0).scramble,2) b = Buffer.sendCollection(s,-10.0.series(-9,10.0).scramble,2)
b.plot.plotMode_(\points) b.plot.plotMode_(\points)
//process and keep just the top values //process
FluidBufScale.process(s,b,c,-20,20,0,1) FluidBufScale.process(s,b,c,-20,20,0,1)
//enjoy //enjoy - same shape, different range
c.plot.plotMode_(\points) c.plot.plotMode_(\points)
:: ::

@ -26,7 +26,7 @@ The index of the buffer to use as the source material to be processed.
ARGUMENT:: destination ARGUMENT:: destination
The index of the buffer to use as the destination for the processed material. The index of the buffer to use as the destination for the processed material.
ARGUMENT:: thresh ARGUMENT:: threshold
The threshold under which values will be zeroed The threshold under which values will be zeroed
ARGUMENT:: action ARGUMENT:: action

Loading…
Cancel
Save