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:
@@ -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();
|
||||||
@@ -208,6 +211,9 @@ 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];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user