This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CleanupThunk : AbstractFunction { | |
var function, value; | |
*new { arg function; | |
^super.newCopyArgs(function) | |
} | |
value { |... args| ^this.prEvaluate(\valueArray, args) } | |
valueArray { |... args| ^this.prEvaluate(\valueArray, *args) } | |
valueEnvir { |... args| ^this.prEvaluate(\valueArrayEnvir, args) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// When you want to Plazy a Pfunc but still want to get resetFunc called | |
// use this instead. See https://bit.ly/37t90WA for more | |
PfuncLazy : Pattern { | |
var <>func; | |
*new { |func| ^super.newCopyArgs(func) } | |
asStream { |inval| | |
var nextFunc, resetFunc; | |
// don't need it for my use(s) to have inval passed to func | |
// but nice to have maybe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* an UnitTestScript for cleanup chaining */ | |
{ |test| | |
var exhaust = { arg pat, ie = (); | |
var cu = EventStreamCleanup.new, oe = nil, str = pat.asStream; | |
var hist = List().add(cu.functions.size); | |
while({ | |
oe = str.next(ie); | |
cu.update(ie); | |
hist.add(cu.functions.size); | |
//[\ULEC, oe, ie, cu.functions.size].postln; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PprotoU : Pattern { | |
var <>makeFunction, <>pattern, <>userCleanupFunc; // distinguish from the combo one we'll generate | |
*new { | makeFunction, pattern, cleanupFunc| | |
^super.newCopyArgs( makeFunction, pattern, cleanupFunc) | |
} | |
storeArgs { ^[makeFunction,pattern,userCleanupFunc] } | |
embedInStream { | event | | |
var stream, ev, evType; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
p = Pbind(\dur, Pseq([1, 2, inf])); | |
(r = PfsetC({var grp = Group(); ~group = grp; | |
{ grp.release.postln; fork { 3.wait; grp.free }}}, p).play); | |
r.reset; // /hit a few time before it reaches the infinite event | |
r.stop; // several groups freed. |