diff --git a/android/src/services/audio.ts b/android/src/services/audio.ts index 280fca3..4852bd4 100644 --- a/android/src/services/audio.ts +++ b/android/src/services/audio.ts @@ -814,6 +814,21 @@ class AudioService { this.pcmBuffer = []; this.pcmBytesCollected = 0; } + // Resume-Sound stoppen falls noch aktiv (User hat nach Anruf eine + // neue Frage gestellt — die alte interruptierte Antwort ist obsolet). + if (this.resumeSound) { + try { this.resumeSound.stop(); this.resumeSound.release(); } catch {} + this.resumeSound = null; + } + // Pending Auto-Resume verwerfen wenn die neue Antwort eine andere + // messageId hat. Sonst spielt nach 30s-Wartezeit der Resume die + // ueberholte Antwort ab. + if (this.pausedMessageId && this.pausedMessageId !== messageId) { + console.log('[Audio] Neue TTS-Antwort (msgId=%s) — Auto-Resume fuer %s verworfen', + messageId, this.pausedMessageId); + this.pausedMessageId = ''; + this.pausedPosition = 0; + } this.pcmStreamActive = true; this.pcmMessageId = messageId; this.pcmSampleRate = sampleRate;