MCPcopy Create free account
hub / github.com/stemdeckapp/stemdeck / startWith

Function startWith

static/js/chunkedAudioEngine.js:320–329  ·  view source on GitHub ↗
(buffers)

Source from the content-addressed store, hash-verified

318 const offsetWithin = _startOffset - chunkIdx * CHUNK_SEC;
319
320 const startWith = (buffers) => {
321 if (!playing || destroyed) return;
322 const when = ctx.currentTime + 0.05;
323 _startCtxTime = when;
324 const dur = _scheduleChunk(buffers, when, offsetWithin);
325 _scheduledTo = _startOffset + dur;
326 _audioStarted = true;
327 _fetchChunk(chunkIdx + 1); // pre-fetch next chunk
328 rafId = requestAnimationFrame(_tick);
329 };
330
331 // chunk 0 is pre-decoded during ready(), so the sync path is the hot path.
332 const hit = _cache.get(chunkIdx);

Callers 1

playFunction · 0.85

Calls 2

_scheduleChunkFunction · 0.85
_fetchChunkFunction · 0.85

Tested by

no test coverage detected