Auto-stop Motif playback on search/song change

- 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 <noreply@anthropic.com>
This commit is contained in:
b1rdmania
2025-12-18 21:14:26 +00:00
parent 02914bdcd0
commit 7209fad127
+8 -2
View File
@@ -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<void> {
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) => {