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:
+8
-2
@@ -142,6 +142,9 @@ class MotifApp {
|
|||||||
const songName = this.songInput.value.trim();
|
const songName = this.songInput.value.trim();
|
||||||
if (!songName) return;
|
if (!songName) return;
|
||||||
|
|
||||||
|
// Stop any playing Motif audio
|
||||||
|
this.handleMotifStop();
|
||||||
|
|
||||||
this.updateStatus('Searching for MIDI files...');
|
this.updateStatus('Searching for MIDI files...');
|
||||||
this.searchBtn.disabled = true;
|
this.searchBtn.disabled = true;
|
||||||
this.hideResults();
|
this.hideResults();
|
||||||
@@ -207,10 +210,13 @@ class MotifApp {
|
|||||||
|
|
||||||
public async selectResult(index: number): Promise<void> {
|
public async selectResult(index: number): Promise<void> {
|
||||||
if (index < 0 || index >= this.searchResults.length) return;
|
if (index < 0 || index >= this.searchResults.length) return;
|
||||||
|
|
||||||
|
// Stop any playing Motif audio
|
||||||
|
this.handleMotifStop();
|
||||||
|
|
||||||
this.selectedResultIndex = index;
|
this.selectedResultIndex = index;
|
||||||
const result = this.searchResults[index];
|
const result = this.searchResults[index];
|
||||||
|
|
||||||
// Update selection highlighting
|
// Update selection highlighting
|
||||||
const rows = this.resultsBody.querySelectorAll('tr');
|
const rows = this.resultsBody.querySelectorAll('tr');
|
||||||
rows.forEach((row, i) => {
|
rows.forEach((row, i) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user