4 *new { arg pattern, dict;
5 ^super.new(pattern).dict_(dict)
7 storeArgs { ^[pattern,dict] }
11 ^(dict ?? { this.lookupClass.all }).at(key) ?? { this.lookupClass.default }
14 embedInStream { arg inval;
16 str = pattern.asStream;
18 outval = str.next(inval);
22 pat = this.getPattern(outval);
23 inval = pat.embedInStream(inval);
30 ^if(key.isSequenceableCollection) {
31 this.lookupClass.parallelise(
33 this.lookUp(each.asSymbol)
37 this.lookUp(key.asSymbol)
46 lookupClass { ^Pdefn }
51 var <>quant, <>dur, <>tolerance;
53 *new { arg pattern, dict, quant, dur, tolerance = 0.001;
54 ^super.newCopyArgs(pattern, dict, quant, dur, tolerance)
56 storeArgs { ^[ pattern, dict, quant, dur, tolerance ] }
57 embedInStream { arg inval;
58 var str, outval, pat, quantVal, quantStr, durVal, durStr;
59 str = pattern.asStream;
60 quantStr = quant.asStream;
61 durStr = dur.asStream;
64 outval = str.next(inval);
65 quantVal = quantStr.next(inval) ? quantVal;
66 durVal = durStr.next(inval) ? durVal;
69 pat = Psync(this.getPattern(outval), quantVal, durVal, tolerance);
70 inval = pat.embedInStream(inval);
78 embedInStream { arg inval;
79 var str, which, streams, outval, pat, currentStream;
80 str = pattern.asStream;
81 streams = IdentityDictionary.new;
83 which = str.next(inval);
86 pat = this.getPattern(which);
87 currentStream = streams.at(pat);
88 if(currentStream.isNil) {
89 currentStream = pat.asStream;
90 streams.put(pat, currentStream);
92 outval = currentStream.next(inval);
102 embedInStream { arg inval, cleanup;
103 var str, which, streams, outval, pat, currentStream;
104 str = pattern.asStream;
105 streams = IdentityDictionary.new;
106 cleanup ?? { cleanup = EventStreamCleanup.new };
109 which = str.next(inval);
112 pat = this.getPattern(which);
113 currentStream = streams.at(pat);
114 if(currentStream.isNil) {
115 currentStream = pat.asStream;
116 streams.put(pat, currentStream);
118 outval = currentStream.next(inval);
119 if(outval.isNil) { ^cleanup.exit(inval) };
121 cleanup.update(outval);
125 ^cleanup.exit(inval);