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

Function _scheduleChunk

static/js/chunkedAudioEngine.js:240–255  ·  view source on GitHub ↗
(buffers, when, startSecs)

Source from the content-addressed store, hash-verified

238 // time), beginning `startSecs` into each buffer. Returns the duration of audio
239 // that will play (max over stems of buffer.duration - startSecs).
240 function _scheduleChunk(buffers, when, startSecs) {
241 let playDur = 0;
242 for (const [name, stem] of stemMap) {
243 const buf = buffers.get(name);
244 if (!buf) continue;
245 const node = ctx.createBufferSource();
246 node.buffer = buf;
247 if (!stNode) node.playbackRate.value = _playbackRate; // tape-effect fallback
248 node.connect(stem.gain);
249 const offset = Math.max(0, Math.min(startSecs, buf.duration - 0.001));
250 node.start(when, offset);
251 stem.activeNodes.push(node);
252 playDur = Math.max(playDur, buf.duration - offset);
253 }
254 return playDur;
255 }
256
257 // --- lookahead scheduler ---
258

Callers 2

_scheduleNextFunction · 0.85
startWithFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected