Skip to content

Commit e477e5f

Browse files
committed
Alternative time alignment check in mc.sampleseq
1 parent 5541ca8 commit e477e5f

File tree

5 files changed

+8
-3
lines changed

5 files changed

+8
-3
lines changed

js/packages/offline-renderer/elementary-wasm.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
1.92 KB
Binary file not shown.

js/packages/web-renderer/raw/elementary-wasm.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
1.92 KB
Binary file not shown.

runtime/elem/builtins/mc/SampleSeq.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,15 @@ namespace elem
267267
|| (prevEvent != seqEnd && before(t, prevEvent->first))
268268
|| (nextEvent != seqEnd && after(t, nextEvent->first));
269269

270+
double const timeUnitsPerSample = sampleDur / (double) activeBuffer->numSamples();
271+
int64_t const sampleTime = t / timeUnitsPerSample;
272+
bool const significantTimeChange = std::abs(sampleTime - nextExpectedBlockStart) > 16;
273+
nextExpectedBlockStart = sampleTime + numSamples;
274+
270275
// TODO: if the input time has changed significantly, need to address the input latency of
271276
// the phase vocoder by resetting it and then pushing stretch.inputLatency * stretchFactor
272277
// samples ahead of `timeInSamples(t)`
273-
if (shouldUpdateBounds || !readers[activeReader].isAlignedWithTime(t)) {
278+
if (shouldUpdateBounds || significantTimeChange) {
274279
updateEventBoundaries(t);
275280
}
276281

0 commit comments

Comments
 (0)