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

Function destroyPlayer

static/js/player.js:579–659  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

577}
578
579export function destroyPlayer() {
580 document.querySelector(".app")?.classList.remove("is-import");
581 document.querySelector(".app")?.classList.remove("engine-waveforms");
582 document.querySelector(".app")?.classList.add("no-track");
583 destroySections();
584 stopVuLoop();
585 stopStemVuLoop();
586 resetSpeed();
587 if (audioEngine) {
588 audioEngine.destroy();
589 setAudioEngine(null);
590 }
591 if (multitrack) {
592 multitrack.destroy();
593 setMultitrack(null);
594 }
595 if (visualAudioContext) {
596 visualAudioContext.close().catch(() => {});
597 visualAudioContext = null;
598 }
599 renderPlaceholderTracks();
600 clearOverviewWaveforms();
601 for (const row of mixerEl.querySelectorAll(".lane-header")) {
602 const dl = row.querySelector(".lane-dl");
603 if (dl) {
604 dl.href = "#";
605 dl.removeAttribute("download");
606 }
607 }
608 resetMixerState();
609 refreshMixerVisuals();
610 setLaneControlsEnabled(false);
611 // Reset static rows, then keep the pre-import shell to extractable stems
612 // only. wireUpAudio will re-apply the exact returned-track set.
613 clearStemSelectionFilter();
614 applyStemSelectionFilter(new Set(STEM_NAMES));
615 npThumb.classList.remove("loaded");
616 npThumb.removeAttribute("src");
617
618 rulerTime.innerHTML = '<div class="playhead-marker" aria-hidden="true"><svg viewBox="0 0 10 10" width="10" height="10"><polygon points="0,0 10,0 5,8" fill="#e54e4e"></polygon></svg></div>';
619 wavesGrid.innerHTML = "";
620
621 titleEl.textContent = "";
622 bpmChip.textContent = "\u2014 BPM";
623 keyChip.textContent = "\u2014 \u2014";
624 stemsChip.textContent = "\u2014 Stems";
625 timeEl.textContent = "00:00 / 00:00";
626 resetAnalysisCards();
627
628 trackAnalysers.length = 0;
629 for (const row of document.querySelectorAll(".energy-row")) {
630 const bar = row.querySelector("b");
631 const txt = row.querySelector("em");
632 if (bar) bar.style.setProperty("--v", "0%");
633 if (txt) txt.textContent = "0%";
634 }
635 setTotalDuration(0);
636 setLoopEnabled(false);

Callers 1

resetFunction · 0.90

Calls 15

destroySectionsFunction · 0.90
stopVuLoopFunction · 0.90
resetSpeedFunction · 0.90
setAudioEngineFunction · 0.90
setMultitrackFunction · 0.90
resetMixerStateFunction · 0.90
refreshMixerVisualsFunction · 0.90
setLaneControlsEnabledFunction · 0.90
setTotalDurationFunction · 0.90
setLoopEnabledFunction · 0.90
setLoopStartFunction · 0.90
setLoopEndFunction · 0.90

Tested by

no test coverage detected