From 7209fad12720016819974f7a67a90453aca7cec6 Mon Sep 17 00:00:00 2001 From: b1rdmania <102524336+b1rdmania@users.noreply.github.com> Date: Thu, 18 Dec 2025 21:14:26 +0000 Subject: [PATCH] Auto-stop Motif playback on search/song change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Stop Motif audio when starting a new search - Stop Motif audio when selecting a different song - Prevents overlapping audio from previous generations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- src/main.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main.ts b/src/main.ts index bdd21f5..e4b379a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -142,6 +142,9 @@ class MotifApp { const songName = this.songInput.value.trim(); if (!songName) return; + // Stop any playing Motif audio + this.handleMotifStop(); + this.updateStatus('Searching for MIDI files...'); this.searchBtn.disabled = true; this.hideResults(); @@ -207,10 +210,13 @@ class MotifApp { public async selectResult(index: number): Promise { if (index < 0 || index >= this.searchResults.length) return; - + + // Stop any playing Motif audio + this.handleMotifStop(); + this.selectedResultIndex = index; const result = this.searchResults[index]; - + // Update selection highlighting const rows = this.resultsBody.querySelectorAll('tr'); rows.forEach((row, i) => {