Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

class library: introduce UGen-blend method

fixes #641

Signed-off-by: Tim Blechmann <tim@klingt.org>
(cherry picked from commit 9056515)
  • Loading branch information...
commit a0e3223babcf9ff9a49af6c298629273ba188cb6 1 parent 9add8d5
@timblechmann timblechmann authored
View
5 HelpSource/Classes/UGen.schelp
@@ -162,6 +162,11 @@ Wraps the receiver in a link::Classes/Fold:: UGen, folding its output at code::l
method:: wrap
Wraps the receiver in a link::Classes/Wrap:: UGen, wrapping its output at code::lo:: and code::hi::.
+method:: blend
+Blends code::this:: with code::that:: by wraping the receiver in an link::Classes/XFade2:: (if code::this:: or code::that:: are audio-rate UGens) or link::Classes/LinXFade2:: UGen.
@crucialfelix Owner

wrapping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+note:: The code::blendFrac:: argument is between 0 and 1::
+
+
method:: lag
Wraps the receiver in a link::Classes/Lag:: UGen, smoothing its output by code::t1:: seconds lagtime. If a second argument is given, it wraps it in a link::Classes/LagUD:: UGen.
View
17 SCClassLibrary/Common/Audio/UGen.sc
@@ -100,6 +100,23 @@ UGen : AbstractFunction {
Wrap.perform(Wrap.methodSelectorForRate(rate), this, lo, hi)
}
}
+ blend { arg that, blendFrac = 0.5;
+ var pan;
+ ^if (rate == \demand || that.rate == \demand) {
+ this.notYetImplemented(thisMethod)
+ } {
+ pan = blendFrac.linlin(0.0, 1.0, -1, 1);
+ if (rate == \audio) {
+ ^XFade2.ar(this, that, pan)
+ };
+
+ if (that.rate == \audio) {
+ ^XFade2.ar(that, this, pan.neg)
+ };
+
+ ^LinXFade2.perform(LinXFade2.methodSelectorForRate(rate), this, that, pan)
+ }
+ }
minNyquist { ^min(this, SampleRate.ir * 0.5) }
View
7 SCClassLibrary/Common/Core/AbstractFunction.sc
@@ -158,11 +158,12 @@ AbstractFunction {
ref { ^this.composeUnaryOp('asRef') }
// nary operators
- clip { arg lo, hi; ^this.composeNAryOp('clip', [lo,hi]) }
+ clip { arg lo, hi; ^this.composeNAryOp('clip', [lo,hi]) }
wrap { arg lo, hi; ^this.composeNAryOp('wrap', [lo,hi]) }
fold { arg lo, hi; ^this.composeNAryOp('fold', [lo,hi]) }
- blend { arg that, blendFrac = 0.5; ^this.composeNAryOp('blend', [that, blendFrac]) }
-
+ blend { arg that, blendFrac = 0.5;
+ ^this.composeNAryOp('blend', [that, blendFrac])
+ }
linlin { arg inMin, inMax, outMin, outMax, clip=\minmax;
^this.composeNAryOp('linlin', [inMin, inMax, outMin, outMax, clip])
}
Please sign in to comment.
Something went wrong with that request. Please try again.