1 // This class is used to encapsulate quantization issues associated with EventStreamPlayer and TempoClock
2 // quant and phase determine the starting time of something scheduled by a TempoClock
3 // timingOffset is an additional timing factor that allows an EventStream to compute "ahead of time" enough to allow
4 // negative lags for strumming a chord, etc
7 var <>quant, <>phase, <>timingOffset;
9 *default { ^default ?? { Quant.new } }
10 *default_ { |quant| default = quant.asQuant }
12 *new { |quant = 0, phase, timingOffset| ^super.newCopyArgs(quant, phase, timingOffset) }
14 nextTimeOnGrid { | clock |
15 ^clock.nextTimeOnGrid(quant, (phase ? 0) - (timingOffset ? 0));
18 asQuant { ^this.copy }
21 stream << "Quant(" << quant;
22 if(phase.notNil) { stream << ", " << phase };
23 if(timingOffset.notNil) {
28 stream << timingOffset
33 storeArgs { ^[quant, phase, timingOffset] }