Skip to content
Browse files

Pattern cleanups:

Consistently allow functions for e.g. repeats.do --> repeats.value(inval).do -- this also passes in 'inval'

Minor formatting fixes

git-svn-id: https://supercollider.svn.sourceforge.net/svnroot/supercollider/trunk@9921 a380766d-ff14-0410-b294-a243070f3f08
  • Loading branch information...
1 parent 888c32b commit 08fcf098c87d27c2eb12ab784bc8d89563abe876 James Harkins committed Mar 3, 2010
View
2 common/build/SCClassLibrary/Common/Streams/BasicOpsStream.sc
@@ -101,7 +101,5 @@ NAryOpStream : Stream {
reset { a.reset; arglist.do({ arg item; item.reset }) }
storeOn { arg stream; stream <<< a << "." << operator << "(" <<<* arglist << ")" }
-
-
}
View
51 common/build/SCClassLibrary/Common/Streams/ControlPatterns.sc
@@ -11,32 +11,33 @@ Phid : Pattern {
storeArgs { ^[element,locID,repeats] }
embedInStream { arg event;
var all, device, spec, elements, deviceName, min, max;
+
+ all = HIDDeviceService.devices;
+ if(all.isNil, {
+ HIDDeviceService.buildDeviceList;
all = HIDDeviceService.devices;
- if(all.isNil, {
- HIDDeviceService.buildDeviceList;
- all = HIDDeviceService.devices;
- });
- device = all.at(locID);
- if(device.isNil, { "device not found".error; ^nil });
- if(element.isNumber.not, {
- element = HIDDeviceService.keyToIndex(element, locID);
- if(element.isNil, { "key not found".error; ^nil });
- });
- elements = device.elements;
- min = elements.at(element).min;
- max = elements.at(element).max;
- spec = ControlSpec.new(min, max, 'lin', 1);
- if((min === 0) and: {max === 1}, {
- repeats.value.do({
- event = device.value(element).yield
- });
- ^event
- }, {
- repeats.value.do({
- event = spec.unmap(device.value(element)).yield
- });
- ^event;
- })
+ });
+ device = all.at(locID);
+ if(device.isNil, { "device not found".error; ^nil });
+ if(element.isNumber.not, {
+ element = HIDDeviceService.keyToIndex(element, locID);
+ if(element.isNil, { "key not found".error; ^nil });
+ });
+ elements = device.elements;
+ min = elements.at(element).min;
+ max = elements.at(element).max;
+ spec = ControlSpec.new(min, max, 'lin', 1);
+ if((min === 0) and: {max === 1}, {
+ repeats.value(event).do({
+ event = device.value(element).yield
+ });
+ ^event
+ }, {
+ repeats.value(event).do({
+ event = spec.unmap(device.value(element)).yield
+ });
+ ^event;
+ })
}
}
View
99 common/build/SCClassLibrary/Common/Streams/FilterPatterns.sc
@@ -14,7 +14,7 @@ Pn : FilterPattern {
}
storeArgs { ^[pattern,repeats] }
embedInStream { arg event;
- repeats.value.do { event = pattern.embedInStream(event) };
+ repeats.value(event).do { event = pattern.embedInStream(event) };
^event;
}
}
@@ -177,8 +177,6 @@ Pset : FilterPattern {
this.filterEvent(inEvent, val);
event = inEvent.yield;
-
-
}
}
}
@@ -291,18 +289,16 @@ Pstretchp : Pstretch {
}
+// needs testing - hjh
Pplayer : FilterPattern {
- var <>playerPattern, <>subPattern;
- // this is broken:
+ var <>subPattern;
*new { arg playerPattern, subPattern;
- // super new copy args puts it in pattern, playerPattern
- // -cx
^super.newCopyArgs(playerPattern, subPattern)
}
- storeArgs { ^[ playerPattern, subPattern ] }
+ storeArgs { ^[ pattern, subPattern ] }
embedInStream { arg event;
var player, inevent;
- var playerStream = playerPattern.asStream;
+ var playerStream = pattern.asStream;
var stream = subPattern.asStream;
loop{
inevent = stream.next(event);
@@ -313,6 +309,9 @@ Pplayer : FilterPattern {
event = yield(inevent);
}
}
+ // backward compatibility: unnecessary var playerPattern was removed
+ playerPattern { ^pattern }
+ playerPattern_ { |playerPattern| pattern = playerPattern }
}
@@ -327,7 +326,7 @@ Pdrop : FilterPattern {
var inevent;
var stream = pattern.asStream;
- count.value.do {
+ count.value(event).do {
inevent = stream.next(event);
if (inevent.isNil, { ^event });
};
@@ -351,7 +350,7 @@ Pfin : FilterPattern {
var inevent;
var stream = pattern.asStream;
cleanup ?? { cleanup = EventStreamCleanup.new };
- count.value.do({
+ count.value(event).do({
inevent = stream.next(event) ?? { ^event };
cleanup.update(inevent);
event = inevent.yield;
@@ -364,13 +363,14 @@ Pfin : FilterPattern {
// it is not correct to call stream.next(nil) on a value stream
// but there is no good way to distinguish in Pfin so we need a subclass
+// might be ok to deprecate this now
Pfinval : Pfin {
embedInStream { arg event;
var inevent;
var stream = pattern.asStream;
- count.value.do({
+ count.value(event).do({
inevent = stream.next(event);
if (inevent.isNil, { ^event });
event = inevent.yield;
@@ -388,19 +388,20 @@ Pfindur : FilterPattern {
asStream { | cleanup| ^Routine({ arg inval; this.embedInStream(inval, cleanup) }) }
embedInStream { arg event, cleanup;
- var item, delta, elapsed = 0.0, nextElapsed, inevent;
-
+ var item, delta, elapsed = 0.0, nextElapsed, inevent,
+ localdur = dur.value(event);
var stream = pattern.asStream;
+
cleanup ?? { cleanup = EventStreamCleanup.new };
loop {
inevent = stream.next(event) ?? { ^event };
cleanup.update(inevent);
delta = inevent.delta;
nextElapsed = elapsed + delta;
- if (nextElapsed.roundUp(tolerance) >= dur) {
+ if (nextElapsed.roundUp(tolerance) >= localdur) {
// must always copy an event before altering it.
// fix delta time and yield to play the event.
- inevent = inevent.copy.put(\delta, dur - elapsed).yield;
+ inevent = inevent.copy.put(\delta, localdur - elapsed).yield;
^cleanup.exit(inevent);
};
@@ -409,7 +410,6 @@ Pfindur : FilterPattern {
}
}
-
}
Psync : FilterPattern {
@@ -421,15 +421,16 @@ Psync : FilterPattern {
embedInStream { arg event;
var item, stream, delta, elapsed = 0.0, nextElapsed, clock, inevent;
+ var localquant = quant.value(event), localmaxdur = maxdur.value(event);
var cleanup = EventStreamCleanup.new;
stream = pattern.asStream;
loop {
inevent = stream.next(event);
if(inevent.isNil) {
- if(quant.notNil) {
- event = Event.silent(elapsed.roundUp(quant) - elapsed, event);
+ if(localquant.notNil) {
+ event = Event.silent(elapsed.roundUp(localquant) - elapsed, event);
^cleanup.exit(event).yield;
};
};
@@ -438,20 +439,17 @@ Psync : FilterPattern {
delta = inevent.delta;
nextElapsed = elapsed + delta;
- if (maxdur.notNil and: { nextElapsed.round(tolerance) >= maxdur })
- {
+ if (localmaxdur.notNil and: { nextElapsed.round(tolerance) >= localmaxdur }) {
inevent = inevent.copy;
- inevent.put(\delta, maxdur - elapsed);
+ inevent.put(\delta, localmaxdur - elapsed);
event = inevent.yield;
^cleanup.exit(event);
- }
- {
+ } {
elapsed = nextElapsed;
event = inevent.yield;
};
};
}
-
}
@@ -463,23 +461,23 @@ Pconst : FilterPattern {
storeArgs { ^[sum,pattern,tolerance] }
embedInStream { arg inval;
- var delta, elapsed = 0.0, nextElapsed, str=pattern.asStream,
- localSum = sum.value(inval);
- loop ({
- delta = str.next(inval);
- if(delta.isNil) {
- (localSum - elapsed).yield;
- ^inval
- };
- nextElapsed = elapsed + delta;
- if (nextElapsed.round(tolerance) >= localSum) {
- (localSum - elapsed).yield;
- ^inval
- }{
- elapsed = nextElapsed;
- inval = delta.yield;
- };
- });
+ var delta, elapsed = 0.0, nextElapsed, str=pattern.asStream,
+ localSum = sum.value(inval);
+ loop ({
+ delta = str.next(inval);
+ if(delta.isNil) {
+ (localSum - elapsed).yield;
+ ^inval
+ };
+ nextElapsed = elapsed + delta;
+ if (nextElapsed.round(tolerance) >= localSum) {
+ (localSum - elapsed).yield;
+ ^inval
+ }{
+ elapsed = nextElapsed;
+ inval = delta.yield;
+ };
+ });
}
}
@@ -494,9 +492,8 @@ Plag : FilterPattern {
var stream = pattern.asStream;
var inevent = event.copy;
- inevent.put('freq', \rest);
- inevent.put('dur', lag);
- event = inevent.yield;
+ event = Event.silent(lag.value(event), event).yield;
+
loop {
inevent = stream.next(event);
if (inevent.isNil) { ^event};
@@ -622,7 +619,6 @@ Pclutch : FilterPattern {
clutch = clutchStream.next(inval);
clutch.notNil
} {
-
if(clutch === true or: { clutch == 1 }) {
outval = stream.next(inval);
if(outval.isNil) { ^inval };
@@ -631,15 +627,13 @@ Pclutch : FilterPattern {
outval ?? { outval = stream.next(inval) };
inval = outval.copy.yield;
};
-
-
}
}
}
Pwhile : FuncFilterPattern {
embedInStream {arg event;
- while({ func.value },{
+ while({ func.value(event) },{
event = pattern.embedInStream(event);
});
^event;
@@ -702,9 +696,7 @@ Ptrace : FilterPattern {
}
};
^collected.embedInStream(inval)
-
}
-
}
Pclump : FilterPattern {
@@ -759,7 +751,6 @@ Pdiff : FilterPattern {
embedInStream { arg event;
var stream = pattern.asStream;
var next, prev = stream.next(event);
- //prev !? { prev.yield };
while {
next = stream.next(event);
next.notNil;
@@ -829,9 +820,5 @@ Pavaroh : FilterPattern {
inval = me.degreeToKey(scale, stepVal).yield
};
^inval
-
}
-
}
-
-
View
8 common/build/SCClassLibrary/Common/Streams/FuncStreamAsRoutine.sc
@@ -3,8 +3,12 @@ FuncStreamAsRoutine : Routine {
var <>resetFunc;
*new { arg nextFunc, resetFunc;
- ^super.new({arg inval; loop { inval = yield(thisThread.nextFunc.value(inval)) } })
- .nextFunc_(nextFunc).resetFunc_(resetFunc)
+ ^super.new({ arg inval;
+ loop {
+ inval = yield(thisThread.nextFunc.value(inval))
+ }
+ })
+ .nextFunc_(nextFunc).resetFunc_(resetFunc)
}
reset { ^resetFunc.value }
View
138 common/build/SCClassLibrary/Common/Streams/ListPatterns.sc
@@ -7,7 +7,7 @@ Pindex : Pattern {
embedInStream { arg inval;
var indexStream, index, item, itemCount;
var listStream = listPat.asStream;
- repeats.do {
+ repeats.value(inval).do {
var list = listStream.next(inval);
if (list.isNil) { ^inval };
indexStream = indexPat.asStream;
@@ -52,14 +52,14 @@ Pseq : ListPattern {
var item, offsetValue;
offsetValue = offset.value;
if (inval.eventAt('reverse') == true, {
- repeats.value.do({ arg j;
+ repeats.value(inval).do({ arg j;
list.size.reverseDo({ arg i;
item = list.wrapAt(i + offsetValue);
inval = item.embedInStream(inval);
});
});
},{
- repeats.value.do({ arg j;
+ repeats.value(inval).do({ arg j;
list.size.do({ arg i;
item = list.wrapAt(i + offsetValue);
inval = item.embedInStream(inval);
@@ -76,12 +76,12 @@ Pser : Pseq {
var item;
var offsetValue = offset.value;
if (inval.eventAt('reverse') == true, {
- repeats.value.reverseDo({ arg i;
+ repeats.value(inval).reverseDo({ arg i;
item = list.wrapAt(i + offsetValue);
inval = item.embedInStream(inval);
});
},{
- repeats.value.do({ arg i;
+ repeats.value(inval).do({ arg i;
item = list.wrapAt(i + offsetValue);
inval = item.embedInStream(inval);
});
@@ -93,9 +93,9 @@ Pser : Pseq {
Pshuf : ListPattern {
embedInStream { arg inval;
var item, stream;
-
var localList = list.copy.scramble;
- repeats.value.do({ arg j;
+
+ repeats.value(inval).do({ arg j;
localList.size.do({ arg i;
item = localList.wrapAt(i);
inval = item.embedInStream(inval);
@@ -109,7 +109,7 @@ Prand : ListPattern {
embedInStream { arg inval;
var item;
- repeats.value.do({ arg i;
+ repeats.value(inval).do({ arg i;
item = list.at(list.size.rand);
inval = item.embedInStream(inval);
});
@@ -121,7 +121,7 @@ Pxrand : ListPattern {
embedInStream { arg inval;
var item, size;
var index = list.size.rand;
- repeats.value.do({ arg i;
+ repeats.value(inval).do({ arg i;
size = list.size;
index = (index + (size - 1).rand + 1) % size;
item = list.at(index);
@@ -139,7 +139,7 @@ Pwrand : ListPattern {
embedInStream { arg inval;
var item, wVal;
var wStr = weights.asStream;
- repeats.value.do({ arg i;
+ repeats.value(inval).do({ arg i;
wVal = wStr.next(inval);
if(wVal.isNil) { ^inval };
item = list.at(wVal.windex);
@@ -155,7 +155,7 @@ Pfsm : ListPattern {
embedInStream { arg inval;
var item, index=0;
var maxState = ((list.size - 1) div: 2) - 1;
- repeats.value.do({
+ repeats.value(inval).do({
index = 0;
while({
index = list.at(index).choose.clip(0, maxState) * 2 + 2;
@@ -170,14 +170,16 @@ Pfsm : ListPattern {
}
Pdfsm : ListPattern {
- var >startState;
+ var <>startState;
*new { arg list, startState=0, repeats=1;
- ^super.new( list, repeats ).startState_(startState) }
+ ^super.new( list, repeats ).startState_(startState)
+ }
+
embedInStream { arg inval;
var currState, sigStream;
var sig, state, stream;
var numStates = list.size - 1;
- repeats.value.do({
+ repeats.value(inval).do({
currState = startState;
sigStream = list[0].asStream;
@@ -223,9 +225,9 @@ Pswitch : Pattern {
Pswitch1 : Pswitch {
embedInStream { arg inval;
var index, outval;
-
var streamList = list.collect({ arg pattern; pattern.asStream; });
var indexStream = which.asStream;
+
loop {
if ((index = indexStream.next(inval)).isNil) { ^inval };
outval = streamList.wrapAt(index.asInteger).next(inval);
@@ -235,35 +237,11 @@ Pswitch1 : Pswitch {
}
}
-//Pswitch1 : Pattern {
-// var <>list, <>which=0;
-// *new { arg list, which=0;
-// ^super.new.list_(list).which_(which)
-// }
-//
-// asStream {
-// var streamList, indexStream;
-//
-// streamList = list.collect({ arg pattern; pattern.asStream; });
-// indexStream = which.asStream;
-//
-// ^FuncStream.new({ arg inval;
-// var index;
-// if ((index = indexStream.next).notNil, {
-// streamList.wrapAt(index.asInteger).next(inval);
-// });
-// },{
-// streamList.do({ arg stream; stream.reset; });
-// });
-// }
-// storeArgs { ^[ list, which ] }
-//}
-
Ptuple : ListPattern {
embedInStream { arg inval;
var item, streams, tuple, outval;
- repeats.value.do({ arg j;
+ repeats.value(inval).do({ arg j;
var sawNil = false;
streams = list.collect({ arg item; item.asStream });
@@ -286,10 +264,10 @@ Ptuple : ListPattern {
Place : Pseq {
embedInStream { arg inval;
var item;
-
var offsetValue = offset.value;
+
if (inval.eventAt('reverse') == true, {
- repeats.value.do({ arg j;
+ repeats.value(inval).do({ arg j;
list.size.reverseDo({ arg i;
item = list.wrapAt(i + offsetValue);
if (item.isSequenceableCollection, {
@@ -299,7 +277,7 @@ Place : Pseq {
});
});
},{
- repeats.value.do({ arg j;
+ repeats.value(inval).do({ arg j;
list.size.do({ arg i;
item = list.wrapAt(i + offsetValue);
if (item.isSequenceableCollection, {
@@ -319,24 +297,26 @@ Ppatlace : Pseq {
var consecutiveNils = 0, index, repeat, item;
var streamList = list.collect({ |item| item.asStream });
var offsetValue = offset.value;
+ var localRepeats = repeats.value(inval);
+
index = repeat = 0;
- { (repeat < repeats) and: { consecutiveNils < list.size } }.while({
- (inval.eventAt(\reverse) == true).if({
+ while { (repeat < localRepeats) and: { consecutiveNils < list.size } } {
+ if(inval.eventAt(\reverse) == true) {
item = streamList.wrapAt(offsetValue - index - 1);
- }, {
+ } {
item = streamList.wrapAt(offsetValue + index);
- });
- (item = item.next(inval)).notNil.if({
+ };
+ if((item = item.next(inval)).notNil) {
consecutiveNils = 0;
inval = item.embedInStream(inval);
- }, {
+ } {
consecutiveNils = consecutiveNils + 1;
- });
- ((index = index + 1) == list.size).if({
+ };
+ if((index = index + 1) == list.size) {
index = 0;
repeat = repeat + 1;
- });
- });
+ };
+ };
^inval;
}
}
@@ -355,33 +335,33 @@ Pslide : ListPattern {
.wrapAtEnd_(wrapAtEnd);
}
embedInStream { arg inval;
- var item;
- var pos = start;
- var stepStr = step.asStream, stepVal;
- var lenghtStr = len.asStream, lengthVal;
-
- repeats.value.do {
- lengthVal = lenghtStr.next(inval);
- if(lengthVal.isNil) { ^inval };
- if(wrapAtEnd) {
- lengthVal.do { |j|
- item = list.wrapAt(pos + j);
+ var item;
+ var pos = start;
+ var stepStr = step.asStream, stepVal;
+ var lengthStr = len.asStream, lengthVal;
+
+ repeats.value(inval).do {
+ lengthVal = lengthStr.next(inval);
+ if(lengthVal.isNil) { ^inval };
+ if(wrapAtEnd) {
+ lengthVal.do { |j|
+ item = list.wrapAt(pos + j);
+ inval = item.embedInStream(inval);
+ }
+
+ } {
+ lengthVal.do { |j|
+ item = list.at(pos + j);
+ if(item.notNil) {
inval = item.embedInStream(inval);
- }
-
- } {
- lengthVal.do { |j|
- item = list.at(pos + j);
- if(item.notNil) {
- inval = item.embedInStream(inval);
- } {
- ^inval
- };
- }
- };
- stepVal = stepStr.next(inval);
- if(stepVal.isNil) { ^inval };
- pos = pos + stepVal;
+ } {
+ ^inval
+ };
+ }
+ };
+ stepVal = stepStr.next(inval);
+ if(stepVal.isNil) { ^inval };
+ pos = pos + stepVal;
};
^inval;
View
78 common/build/SCClassLibrary/Common/Streams/Patterns.sc
@@ -93,10 +93,8 @@ Pfunc : Pattern {
}
storeArgs { ^[nextFunc] ++ resetFunc }
asStream {
-// ^FuncStreamAsRoutine.new(nextFunc, resetFunc)
- ^FuncStream.new(nextFunc, resetFunc)
+ ^FuncStream.new(nextFunc, resetFunc)
}
-// embedInStream { arg inval; loop { inval = yield(nextFunc.value(inval)) } }
}
Prout : Pattern {
@@ -125,7 +123,7 @@ Pfuncn : Pattern {
}
storeArgs { ^[func,repeats] }
embedInStream { arg inval;
- repeats.value.do({
+ repeats.value(inval).do({
inval = func.value(inval).yield;
});
^inval
@@ -153,8 +151,7 @@ Punop : Pattern {
}
asStream {
- var stream = a.asStream;
- ^UnaryOpStream.new(operator, stream);
+ ^UnaryOpStream.new(operator, a.asStream);
}
}
@@ -171,13 +168,11 @@ Pbinop : Pattern {
}
asStream {
- var streamA = a.asStream;
- var streamB = b.asStream;
if (adverb.isNil) {
- ^BinaryOpStream.new(operator, streamA, streamB);
+ ^BinaryOpStream.new(operator, a.asStream, b.asStream);
};
if (adverb == 'x') {
- ^BinaryOpXStream.new(operator, streamA, streamB);
+ ^BinaryOpXStream.new(operator, a.asStream, b.asStream);
};
^nil
}
@@ -193,8 +188,10 @@ Pnaryop : Pattern {
embedInStream { arg inval;
var streamA, streamlist, vala, values, isNumeric;
streamA = a.asStream;
+ // optimization
isNumeric = arglist.every { arg item;
- item.isNumber or: {item.class === Symbol} }; // optimization
+ item.isNumber or: {item.class === Symbol}
+ };
if (isNumeric) {
loop {
@@ -218,9 +215,7 @@ Pnaryop : Pattern {
}
asStream {
- var streamA = a.asStream;
- var streamlist = arglist.collect({ arg item; item.asStream });
- ^NAryOpStream.new(operator, streamA, streamlist);
+ ^NAryOpStream.new(operator, a.asStream, arglist.collect({ arg item; item.asStream }));
}
}
@@ -361,8 +356,8 @@ Pseries : Pattern { // arithmetic series
embedInStream { arg inval;
var outval, counter = 0;
- var cur = start.value;
- var len = length.value;
+ var cur = start.value(inval);
+ var len = length.value(inval);
var stepStr = step.asStream, stepVal;
while { counter < len } {
stepVal = stepStr.next(inval);
@@ -384,8 +379,8 @@ Pgeom : Pattern { // geometric series
storeArgs { ^[start,grow,length] }
embedInStream { arg inval;
var outval, counter = 0;
- var cur = start.value;
- var len = length.value;
+ var cur = start.value(inval);
+ var len = length.value(inval);
var growStr = grow.asStream, growVal;
while { counter < len } {
@@ -422,7 +417,7 @@ Pbrown : Pattern {
cur = rrand(loVal, hiVal);
if(loVal.isNil or: { hiVal.isNil } or: { stepVal.isNil }) { ^inval };
- length.value.do {
+ length.value(inval).do {
loVal = loStr.next(inval);
hiVal = hiStr.next(inval);
stepVal = stepStr.next(inval);
@@ -455,7 +450,7 @@ Pwhite : Pattern {
var loStr = lo.asStream;
var hiStr = hi.asStream;
var hiVal, loVal;
- length.value.do({
+ length.value(inval).do({
hiVal = hiStr.next(inval);
loVal = loStr.next(inval);
if(hiVal.isNil or: { loVal.isNil }) { ^inval };
@@ -485,12 +480,12 @@ Pprob : Pattern {
var hiStr = hi.asStream;
var hiVal, loVal;
- length.value.do {
+ length.value(inval).do {
loVal = loStr.next(inval);
hiVal = hiStr.next(inval);
if(hiVal.isNil or: { loVal.isNil }) { ^inval };
- inval = ((table.tableRand * (hiVal - loVal)) + loVal).yield; };
-
+ inval = ((table.tableRand * (hiVal - loVal)) + loVal).yield;
+ };
^inval;
}
}
@@ -562,19 +557,20 @@ PstepNfunc : Pattern {
var max = size - 1;
var streams = Array.newClear(size);
var vals = Array.newClear(size);
+ // this variable is needed because of recursion
var f = { arg inval, level=0;
- var val;
- streams[level] = patterns[level].asStream;
- while{
- vals[level] = val = streams[level].next(inval);
- val.notNil;
+ var val;
+ streams[level] = patterns[level].asStream;
+ while{
+ vals[level] = val = streams[level].next(inval);
+ val.notNil;
+ }{
+ if(level < max) {
+ inval = f.value(inval, level + 1)
}{
- if(level < max) {
- inval = f.value(inval, level + 1)
- }{
- inval = yield(function.value(vals));
- }
- };
+ inval = yield(function.value(vals));
+ }
+ };
inval;
};
^f.value(inval);
@@ -599,7 +595,7 @@ Ptime : Pattern {
storeArgs { ^[repeats] }
embedInStream { arg inval;
var start = thisThread.beats;
- repeats.value.do { inval = (thisThread.beats - start).yield };
+ repeats.value(inval).do { inval = (thisThread.beats - start).yield };
^inval
}
}
@@ -653,15 +649,15 @@ Pif : Pattern {
^FuncStream({ |inval|
var test;
- (test = condStream.next(inval)).isNil.if({
+ if((test = condStream.next(inval)).isNil) {
nil
- }, {
- test.if({
+ } {
+ if(test) {
trueStream.next(inval) ? default
- }, {
+ } {
falseStream.next(inval) ? default
- });
- });
+ };
+ };
}, { // reset func
condStream.reset;
trueStream.reset;
View
3 common/build/SCClassLibrary/Common/Streams/Penv.sc
@@ -1,6 +1,5 @@
Penv : Env {
-
embedInStream { arg inval;
var startTime;
startTime = thisThread.endBeat ? thisThread.beats;
@@ -10,6 +9,4 @@ Penv : Env {
{ inval = yield(this.at(thisThread.beats - startTime))};
^inval
}
-
-
}
View
20 common/build/SCClassLibrary/Common/Streams/Pfx.sc
@@ -67,8 +67,6 @@ Pfx : FilterPattern {
}
}
}
-
-
}
Pfxb : Pfx {
@@ -104,9 +102,8 @@ Pgroup : FilterPattern {
inevent = event.yield;
inevent !? { inevent = inevent.copy; inevent[\group] = ingroup };
-// ^this.class.embedLoop(inevent, pattern.asStream, groupID, ingroup, cleanup);
stream = pattern.asStream;
- loop {
+ loop {
event = stream.next(inevent) ?? { ^cleanup.exit(inevent) };
lag = max(lag, clock.beats + event.use { ~sustain.value });
inevent = event.yield;
@@ -117,13 +114,12 @@ Pgroup : FilterPattern {
*embedLoop { arg inevent, stream, groupID, ingroup, cleanup;
var event, lag;
loop {
- event = stream.next(inevent) ?? { ^cleanup.exit(inevent) }; lag = event[\dur];
+ event = stream.next(inevent) ?? { ^cleanup.exit(inevent) };
+ lag = event[\dur];
inevent = event.yield;
inevent.put(\group, groupID);
}
}
-
-
}
Pbus : FilterPattern {
@@ -187,26 +183,16 @@ Pbus : FilterPattern {
// doneAction = 3;
// remove and deallocate both this synth and the preceeding node
// (which is the group).
-
inevent = event.yield;
// now embed the pattern
-
stream = Pchain(pattern, (group: groupID, out: bus)).asStream;
-
-
loop {
-
-
event = stream.next(inevent) ?? { ^cleanup.exit(inevent) };
cleanup.update(event);
inevent = event.yield;
-
-
}
}
-
-
}
View
2 common/build/SCClassLibrary/Common/Streams/Plambda.sc
@@ -75,7 +75,7 @@ Pget : Pattern {
embedInStream { arg inval;
var scope = inval[\eventScope], outval;
if(scope.isNil) { Error("no scope defined in event").throw };
- repeats.value.do {
+ repeats.value(inval).do {
outval = scope[key] ? default;
if(outval.isNil) { ^inval };
outval.yield
View
11 common/build/SCClassLibrary/Common/Streams/PmonoStreams.sc
@@ -66,13 +66,13 @@ PmonoStream : Stream {
server = argServer;
schedBundleArray = ~schedBundleArray;
schedBundle = ~schedBundle;
-
};
cleanup.addFunction(event, currentCleanupFunc = { | flag |
if (flag) { (id: id, server: server, type: \off,
- hasGate: hasGate,
- schedBundleArray: schedBundleArray,
- schedBundle: schedBundle).play }
+ hasGate: hasGate,
+ schedBundleArray: schedBundleArray,
+ schedBundle: schedBundle).play
+ }
});
}
};
@@ -133,5 +133,4 @@ PmonoArticStream : PmonoStream {
}
}
}
-
-}
+}
View
68 common/build/SCClassLibrary/Common/Streams/Ppar.sc
@@ -11,44 +11,32 @@ Ppar : ListPattern {
var assn;
var priorityQ = PriorityQueue.new;
- repeats.value.do({ arg j;
+ repeats.value(inval).do({ arg j;
var outval, stream, nexttime, now = 0.0;
this.initStreams(priorityQ);
// if first event not at time zero
- if (priorityQ.notEmpty and: { (nexttime = priorityQ.topPriority) > 0.0 }, {
-// outval = inval.copy;
-// outval.put(\freq, \rest);
-// outval.put(\delta, nexttime);
-
+ if (priorityQ.notEmpty and: { (nexttime = priorityQ.topPriority) > 0.0 }) {
outval = Event.silent(nexttime, inval);
inval = outval.yield;
now = nexttime;
- });
-
- //inval ?? { this.purgeQueue(priorityQ); ^nil.yield };
+ };
- while({
- priorityQ.notEmpty
- },{
+ while { priorityQ.notEmpty } {
stream = priorityQ.pop;
outval = stream.next(inval);
- if (outval.isNil, {
+ if (outval.isNil) {
nexttime = priorityQ.topPriority;
if (nexttime.notNil, {
// that child stream ended, so rest until next one
-// outval = inval.copy;
-// outval.put(\freq, \rest);
-// outval.put(\delta, nexttime - now);
outval = Event.silent(nexttime - now, inval);
inval = outval.yield;
- // inval ?? { this.purgeQueue(priorityQ); ^nil.yield };
now = nexttime;
},{
priorityQ.clear;
});
- },{
+ } {
// requeue stream
priorityQ.put(now + outval.delta, stream);
nexttime = priorityQ.topPriority;
@@ -57,17 +45,11 @@ Ppar : ListPattern {
inval = outval.yield;
// inval ?? { this.purgeQueue(priorityQ); ^nil.yield };
now = nexttime;
- });
- });
+ };
+ };
});
^inval;
}
-
- /*
- purgeQueue { arg priorityQ;
- while { priorityQ.notEmpty } { priorityQ.pop }
- }*/
-
}
Ptpar : Ppar {
@@ -78,34 +60,8 @@ Ptpar : Ppar {
}
}
-//Ppar : ListPattern {
-// initStreams { arg priorityQ;
-// list.do({ arg pattern, i;
-// priorityQ.put(0.0, pattern.asStream);
-// });
-// }
-// asStream {
-// ^Routine({ arg inval;
-// var count = 0, join, cond;
-// join = list.size;
-// cond = Condition({ count >= join });
-// list.do({ arg func;
-// Routine({ arg time;
-// inval.
-// pattern.embedInStream(inval.copy);
-// count = count + 1;
-// cond.signal;
-// }).play;
-// });
-// cond.wait;
-// });
-// }
-//}
-
-
Pgpar : Ppar {
-
embedInStream { arg inevent;
var server, ids, patterns, event, ingroup, cleanup, stream;
var lag = 0, clock = thisThread.clock,
@@ -125,8 +81,11 @@ Pgpar : Ppar {
inevent = event.yield.copy;
cleanup = EventStreamCleanup.new;
cleanup.addFunction(inevent, { | flag |
- if (flag) { ( lag: lag - clock.beats + groupReleaseTime,
- type: \kill, id: ids, server: server).play };
+ if (flag) {
+ ( lag: lag - clock.beats + groupReleaseTime,
+ type: \kill, id: ids, server: server
+ ).play
+ };
});
patterns = this.wrapPatterns(ids);
@@ -139,7 +98,6 @@ Pgpar : Ppar {
lag = max(lag, clock.beats + event.use { ~sustain.value });
inevent = event.yield;
}
-
}
numberOfGroups { ^list.size }
View
8 common/build/SCClassLibrary/Common/Streams/Ppatmod.sc
@@ -40,9 +40,9 @@ PlazyEnvirN : PlazyEnvir {
patterns = if(passEvent) { genFunc.valueEnvir(inval) } { genFunc.valueEnvir };
};
if(patterns.size > 1) {
- Ppar(patterns).embedInStream(inval)
+ Ppar(patterns).embedInStream(inval)
} {
- patterns.unbubble.embedInStream(inval)
+ patterns.unbubble.embedInStream(inval)
}
}
}
@@ -76,7 +76,7 @@ Ppatmod : Pattern {
}
embedInStream { arg inval;
var localPat;
- localPat = pattern.value.copy;
+ localPat = pattern.value(inval).copy;
repeats.do({ arg i;
inval = localPat.embedInStream(inval);
localPat = func.value(localPat, i);
@@ -94,7 +94,7 @@ Peventmod : Pattern {
}
embedInStream { arg inval;
var localEvent = event.copy ?? { Event.default };
- repeats.value.do { arg i;
+ repeats.value(inval).do { arg i;
if(inval.isNil) { ^nil.yield };
localEvent.use { func.valueEnvir(inval, i) };
inval = localEvent.yield;
View
11 common/build/SCClassLibrary/Common/Streams/Pproto.sc
@@ -12,23 +12,17 @@ Pfpar : ListPattern {
var priorityQ = PriorityQueue.new;
cleanup ?? { cleanup = EventStreamCleanup.new };
- repeats.value.do({ arg j;
+ repeats.value(inval).do({ arg j;
var outval, stream, nexttime, now = 0.0;
this.initStreams(priorityQ);
// if first event not at time zero
if (priorityQ.notEmpty and: { (nexttime = priorityQ.topPriority) > 0.0 }, {
- outval = inval.copy;
- outval.put(\freq, \rest);
- outval.put(\delta, nexttime);
-
- inval = outval.yield;
+ inval = Event.silent(nexttime, inval).yield;
now = nexttime;
});
- //inval ?? { this.purgeQueue(priorityQ); ^nil.yield };
-
while({
priorityQ.notEmpty
},{
@@ -52,7 +46,6 @@ Pfpar : ListPattern {
});
^inval;
}
-
}
Pproto : Pattern {
View
11 common/build/SCClassLibrary/Common/Streams/Pspawner.sc
@@ -57,12 +57,8 @@ Spawner : Pattern {
if (outevent.isNil, {
nexttime = priorityQ.topPriority;
-// if (nexttime.notNil && (genStream != stream), {
if (nexttime.notNil, {
// that child stream ended, so rest until next one
-// outevent = event.copy;
-// outevent.put(\freq, \rest);
-// outevent.put(\delta, nexttime - now);
outevent = Event.silent(nexttime - now, event);
event = outevent.yield;
now = nexttime;
@@ -83,28 +79,23 @@ Spawner : Pattern {
});
^event;
}
-
}
Pspawner : Prout {
-
asStream {
^Routine({ | ev | this.embedInStream(ev) })
}
embedInStream { | inevent, cleanup |
-
^Spawner(routineFunc).embedInStream(inevent, cleanup ?? { EventStreamCleanup.new });
-
}
-
}
Pspawn : FilterPattern {
var <>spawnProtoEvent;
*new { |pattern, spawnProtoEvent|
^super.new(pattern)
- .spawnProtoEvent_(spawnProtoEvent ?? { Event.default/*.put(\type, \spawn)*/ });
+ .spawnProtoEvent_(spawnProtoEvent ?? { Event.default });
}
embedInStream { |inevent, cleanup|
View
53 common/build/SCClassLibrary/Common/Streams/RandomDistPatterns.sc
@@ -1,22 +1,25 @@
-Plprand : Pattern {
- *new { arg lo = 0.0, hi = 1.0, length = inf;
- var pat = Pwhite(lo, hi, length);
- ^min(pat, pat)
+Plprand : Pwhite {
+ embedInStream { |inval|
+ var localLength = length.value(inval),
+ pat = Pwhite(lo, hi, localLength);
+ ^min(pat, pat).embedInStream(inval)
}
}
-Phprand : Pattern {
- *new { arg lo = 0.0, hi = 1.0, length = inf;
- var pat = Pwhite(lo, hi, length);
- ^max(pat, pat)
+Phprand : Pwhite {
+ embedInStream { |inval|
+ var localLength = length.value(inval),
+ pat = Pwhite(lo, hi, localLength);
+ ^max(pat, pat).embedInStream(inval)
}
}
-Pmeanrand : Pattern {
- *new { arg lo = 0.0, hi = 1.0, length = inf;
- var pat = Pwhite(lo, hi, length);
- ^pat + pat * 0.5
+Pmeanrand : Pwhite {
+ embedInStream { |inval|
+ var localLength = length.value(inval),
+ pat = Pwhite(lo, hi, localLength);
+ ^((pat + pat) * 0.5).embedInStream(inval)
}
}
@@ -36,7 +39,7 @@ Pbeta : Pattern {
var prob2Str = prob2.asStream;
var loVal, hiVal;
- length.do({
+ length.value(inval).do({
var sum = 2, temp, rprob1, rprob2;
rprob1 = prob1Str.next(inval);
rprob2 = prob2Str.next(inval);
@@ -49,10 +52,10 @@ Pbeta : Pattern {
while ({
temp = 1.0.rand ** rprob1;
- sum = temp + (1.0.rand ** rprob2); sum > 1;
- });
+ sum = temp + (1.0.rand ** rprob2);
+ sum > 1;
+ });
inval = (((temp/sum) * (hiVal - loVal)) + loVal).yield;
-
});
^inval;
}
@@ -71,17 +74,17 @@ Pcauchy : Pattern {
var meanStr = mean.asStream;
var spreadStr = spread.asStream;
var meanVal, spreadVal;
- length.do({
+ length.value(inval).do({
var ran = 0.5;
meanVal = meanStr.next(inval);
spreadVal = spreadStr.next(inval);
if(meanVal.isNil or: { spreadVal.isNil }) { ^inval };
while({
ran = 1.0.rand;
ran == 0.5
- });
- inval = ((spreadVal * (ran * pi).tan) + meanVal).yield;
});
+ inval = ((spreadVal * (ran * pi).tan) + meanVal).yield;
+ });
^inval;
}
}
@@ -99,12 +102,12 @@ Pgauss : Pattern {
var meanStr = mean.asStream;
var devStr = dev.asStream;
var devVal, meanVal;
- length.do({
+ length.value(inval).do({
devVal = devStr.next(inval);
meanVal = meanStr.next(inval);
if(meanVal.isNil or: { devVal.isNil }) { ^inval };
inval = ((((-2*log(1.0.rand)).sqrt * sin(2pi.rand)) * devVal) + meanVal).yield;
- });
+ });
^inval;
}
}
@@ -118,7 +121,7 @@ Ppoisson : Pattern {
storeArgs{ ^[mean, length] }
embedInStream{ arg inval;
var meanStr = mean.asStream;
- length.do({
+ length.value(inval).do({
var inc, test, temp, meanVal = meanStr.next(inval);
if(meanVal.isNil) { ^inval };
inc = 0;
@@ -129,9 +132,9 @@ Ppoisson : Pattern {
}, {
inc = inc + 1;
test = test * 1.0.rand;
- });
- inval = inc.yield;
});
+ inval = inc.yield;
+ });
^inval;
}
}
@@ -145,7 +148,7 @@ Pexprand : Pwhite {
var loStr = lo.asStream;
var hiStr = hi.asStream;
var hiVal, loVal;
- length.value.do({
+ length.value(inval).do({
hiVal = hiStr.next(inval);
loVal = loStr.next(inval);
if(hiVal.isNil or: { loVal.isNil }) { ^inval };
View
85 common/build/SCClassLibrary/Common/Streams/Stream.sc
@@ -214,13 +214,13 @@ Stream : AbstractFunction {
^Ptrace(this, key, printStream, prefix).asStream
}
- constrain { arg sum, tolerance=0.001;
- ^Pconst(sum, tolerance).asStream
- }
+// constrain { arg sum, tolerance=0.001;
+// ^Pconst(sum, tolerance).asStream
+// }
repeat { arg repeats = inf;
^r { arg inval;
- repeats.do {
+ repeats.value(inval).do {
inval = this.reset.embedInStream(inval)
}
}
@@ -414,87 +414,13 @@ Task : PauseStream {
^super.new(Routine(func), clock)
}
storeArgs { ^originalStream.storeArgs
- ++ if(clock != TempoClock.default) { clock }
+ ++ if(clock != TempoClock.default) { clock }
}
}
////////////////////////////////////////////////////////////////////////
-//EventStreamPlayer : PauseStream {
-// var <>event, <>muteCount = 0, <>cleanup;
-//
-// *new { arg stream, event;
-// ^super.new(stream).event_(event ? Event.default).cleanup_(EventStreamCleanup.new);
-// }
-//
-// // freeNodes is passed as false from
-// //TempoClock:cmdPeriod
-// removedFromScheduler { | freeNodes = true |
-// nextBeat = nil;
-// cleanup.terminate(freeNodes);
-// this.prStop;
-// this.changed(\stopped);
-// }
-// prStop {
-// stream = nextBeat = nil;
-// isWaiting = false;
-// }
-//
-// stop {
-// cleanup.terminate;
-// this.prStop;
-// this.changed(\userStopped);
-// }
-//
-// mute { muteCount = muteCount + 1; }
-// unmute { muteCount = muteCount - 1; }
-// canPause { ^this.streamHasEnded.not and: { cleanup.functions.isEmpty } }
-//
-// next { arg inTime;
-// var nextTime;
-// var outEvent = stream.next(event.copy);
-// if (outEvent.isNil) {
-// streamHasEnded = stream.notNil;
-// cleanup.clear;
-// this.removedFromScheduler;
-// ^nil
-// }{
-// nextTime = outEvent.playAndDelta(cleanup, muteCount > 0);
-// if (nextTime.isNil) { this.removedFromScheduler; ^nil };
-// nextBeat = inTime + nextTime; // inval is current logical beat
-// ^nextTime
-// };
-// }
-//
-// asEventStreamPlayer { ^this }
-//
-// play { arg argClock, doReset = (false), quant;
-// if (stream.notNil, { "already playing".postln; ^this });
-// if (doReset, { this.reset });
-// clock = argClock ? clock ? TempoClock.default;
-// streamHasEnded = false;
-// stream = originalStream;
-// isWaiting = true; // make sure that accidental play/stop/play sequences
-// // don't cause memory leaks
-// era = CmdPeriod.era;
-// quant = quant.asQuant;
-// event = event.synchWithQuant(quant);
-//
-// clock.play({
-// if(isWaiting and: { nextBeat.isNil }) {
-// clock.sched(0, this);
-// isWaiting = false;
-// this.changed(\playing)
-// };
-// nil
-// }, quant);
-// this.changed(\userPlayed);
-// ^this
-// }
-//
-//}
-
EventStreamPlayer : PauseStream {
var <>event, <>muteCount = 0, <>cleanup, <>routine;
@@ -573,5 +499,4 @@ EventStreamPlayer : PauseStream {
this.changed(\userPlayed);
^this
}
-
}
View
121 common/build/SCClassLibrary/Common/Streams/TabFileReader.sc
@@ -6,7 +6,7 @@ FileReader : Stream {
*new { | pathOrFile, skipEmptyLines=false, skipBlanks=false, delimiter |
var stream;
if (pathOrFile.isKindOf(File) ) { stream = pathOrFile } { stream = File(pathOrFile, "r") };
- if (stream.isOpen.not) { warn("FileReader: file" + pathOrFile + "not found.") ^nil };
+ if (stream.isOpen.not) { warn(this.name ++ ": file" + pathOrFile + "not found.") ^nil };
^super.newCopyArgs(stream, skipEmptyLines, skipBlanks, delimiter ? this.delim)
}
@@ -16,10 +16,10 @@ FileReader : Stream {
next {
var c, record, string = String.new;
- while ({
+ while {
c = stream.getChar;
c.notNil
- },{
+ } {
if (c == delimiter) {
if (skipBlanks.not or: { string.size > 0 }) {
record = record.add(string);
@@ -29,15 +29,15 @@ FileReader : Stream {
if (c == $\n or: { c == $\r }) {
record = record.add(string);
string = String.new;
- if (skipEmptyLines.not or: { (record != [ "" ]) })
- {^record };
+ if (skipEmptyLines.not or: { (record != [ "" ]) }) {
+ ^record
+ };
record = nil;
}{
string = string.add(c);
}
}
-
- });
+ };
if (string.notEmpty) { ^record.add(string) };
^record;
}
@@ -73,110 +73,3 @@ CSVFileReader : FileReader {
SemiColonFileReader : FileReader {
classvar <delim = $;;
}
-//FileReader {
-// // a class to read text files automatically
-// classvar <delim = $ ; // space separated by default
-// var stream;
-//
-// *new { arg stream;
-// ^super.newCopyArgs(stream)
-// }
-//
-// *read { arg path, skipEmptyLines=false, skipBlanks=false, func, delimiter, startRow=0, subsample=1;
-// var f, table;
-// f = File(path, "r");
-// if (f.isOpen.not) { warn("FileReader: file" + path + "not found.") ^nil };
-// table = this.new(f).read(skipEmptyLines, skipBlanks, func, (delimiter), startRow, subsample);
-// f.close;
-// ^table;
-// }
-// read { arg skipEmptyLines=false, skipBlanks=false, func, delimiter, startRow=0, subsample=1;
-// var string, record, table, c, subsampctr, subsampfunc;
-//
-// delimiter = delimiter ? this.class.delim;
-// string = String.new;
-// subsampctr = 0; // Used for subsampling
-//
-// // subsample can be a function (e.g. {0.5.coin} for randomised subsampling) or an integer for uniform subsampling.
-// // We convert subsample into a function that the read loop can use
-// subsampfunc = if(subsample == 1){
-// true // Optimise for common case, just give "true" rather than a function!
-// }{
-// if(subsample.isFunction){subsample}{
-// // For integer values we build a simple counter - this function:
-// {if(subsampctr % subsample == 0){
-// subsampctr = 1;
-// true
-// }{
-// subsampctr = subsampctr + 1;
-// false
-// }}
-// }
-// };
-//
-// // Now do the actual file reading:
-// while ({
-// c = stream.getChar;
-// c.notNil
-// },{
-// if (c == delimiter, {
-// if (skipBlanks.not or: { string.size > 0 }) {
-// func !? { string = func.value(string) };
-// record = record.add(string);
-// string = String.new;
-// }
-// },{
-// if (c == $\n or: { c == $\r }, {
-// func !? { string = func.value(string) };
-// record = record.add(string);
-// string = String.new;
-// // or line is not empty
-// if (skipEmptyLines.not or: { (record != [ "" ]) })
-// {
-// // We have a completed record. Are we going to add it?
-// if(startRow > 0){
-// startRow = startRow - 1; // startRow used as a countdown
-// }{
-// if(subsampfunc.value){
-// table = table.add(record);
-// }
-// }
-// };
-//
-// record = nil;
-// },{
-// string = string.add(c);
-// })});
-//
-// });
-// // add last string if there is one!
-// if (string.notEmpty) {
-// func !? { string = func.value(string) };
-// if(startRow > 0 and:{subsampfunc.value}){
-// record = record.add(string)
-// }
-// };
-// if (record.notNil) { table = table.add(record) };
-// ^table
-// }
-//
-// *readInterpret { arg path, skipEmptyLines=false, skipBlanks=false;
-// ^this.read(path, skipEmptyLines, skipBlanks, _.interpret);
-// }
-//
-// readInterpret { arg skipEmptyLines=false, skipBlanks=false;
-// ^this.read(skipEmptyLines, skipBlanks=false, _.interpret)
-// }
-//}
-//
-//TabFileReader : FileReader {
-// classvar <delim = $\t;
-//}
-//
-//CSVFileReader : FileReader {
-// classvar <delim = $,;
-//}
-//
-//SemiColonFileReader : FileReader {
-// classvar <delim = $;;
-//}
View
24 common/build/SCClassLibrary/Common/Streams/TimePatterns.sc
@@ -13,7 +13,7 @@ Pstep : Pattern {
// endBeat > beats only if Pfindur ended something early
thisThread.endBeat = thisThread.endBeat min: thisThread.beats;
- repeats.do { | i |
+ repeats.value(inval).do { | i |
stream = Ptuple([list, durs]).asStream;
while (
{ #val, dur = stream.next(inval) ? [nil, nil];
@@ -44,35 +44,35 @@ Pseg : Pstep {
var valStream, durStream, curveStream, startVal, val, dur, curve;
var env;
var startTime, curTime;
- repeats.do {
+ repeats.value(inval).do {
valStream = list.asStream;
durStream = durs.asStream;
curveStream = curves.asStream;
val = valStream.next(inval) ?? {^inval};
thisThread.endBeat = thisThread.endBeat ? thisThread.beats min: thisThread.beats;
- while ({
+ while {
startVal = val;
val = valStream.next(inval);
dur = durStream.next(inval);
curve = curveStream.next(inval);
- val.notNil && dur.notNil && curve.notNil
- }, {
+ val.notNil and: { dur.notNil and: { curve.notNil } }
+ } {
startTime = thisThread.endBeat;
thisThread.endBeat = thisThread.endBeat + dur;
if (startVal.isArray) {
env = [startVal,val, dur, curve].flop.collect { | args |
Env([args[0], args[1]], [args[2]], args[3]) };
- while(
- { thisThread.endBeat > curTime = thisThread.beats },
- { inval = yield(env.collect{ | e | e.at(curTime - startTime)}) })
+ while { thisThread.endBeat > curTime = thisThread.beats } {
+ inval = yield(env.collect{ | e | e.at(curTime - startTime)})
+ }
} {
env = Env([startVal, val], [dur], curve);
- while(
- { thisThread.endBeat > curTime = thisThread.beats },
- { inval = yield(env.at(curTime - startTime) ) })
+ while { thisThread.endBeat > curTime = thisThread.beats } {
+ inval = yield(env.at(curTime - startTime))
+ }
}
- })
+ }
}
}
storeArgs {
View
9 common/build/SCClassLibrary/Common/Streams/extEnv.sc
@@ -9,10 +9,11 @@
thisThread.endBeat = this.times.sum + startTime;
loop {
inval = yield(this.at(thisThread.beats - startTime));
- }
+ }
}
+
asStream {
- ^Routine({ arg inval; this.embedInStream(inval) })Ê
+ ^Routine({ arg inval; this.embedInStream(inval) })
}
asSignal { arg length = 400;
@@ -25,6 +26,6 @@
}
plot { arg size = 400, bounds, minval, maxval, parent;
- this.asSignal(size).plot(bounds: bounds, minval: minval, maxval: maxval, parent: parent); }
-
+ this.asSignal(size).plot(bounds: bounds, minval: minval, maxval: maxval, parent: parent);
+ }
}

0 comments on commit 08fcf09

Please sign in to comment.
Something went wrong with that request. Please try again.