MCPcopy
hub / github.com/stemdeckapp/stemdeck / applySpeed

Function applySpeed

static/js/transport.js:437–453  ·  view source on GitHub ↗
(rate)

Source from the content-addressed store, hash-verified

435}
436
437function applySpeed(rate) {
438 const clamped = Math.max(0.25, Math.min(2, rate));
439 setPlaybackSpeed(clamped);
440 if (speedEl) {
441 speedEl.value = String(clamped);
442 // range is 0-2; 1.0 sits at exactly 50%
443 const pct = (clamped / 2) * 100;
444 speedEl.style.setProperty("--speed-pct", `${pct.toFixed(1)}%`);
445 }
446 if (speedLabelEl) speedLabelEl.textContent = `${clamped % 1 === 0 ? clamped.toFixed(1) : clamped}x`;
447 audioEngine?.setPlaybackRate?.(clamped);
448 if (multitrack) {
449 for (const a of (multitrack.audios ?? [])) {
450 try { a.playbackRate = clamped; } catch { /* noop */ }
451 }
452 }
453}
454
455export function resetSpeed() {
456 applySpeed(1.0);

Callers 2

resetSpeedFunction · 0.85
wireSpeedControlFunction · 0.85

Calls 1

setPlaybackSpeedFunction · 0.90

Tested by

no test coverage detected