Fix double _tts_finished() call when stop word interrupts TTS (#256)
tts_player.stop() already invokes its done_callback which is _tts_finished(), so the explicit self._tts_finished() call immediately after was a duplicate. This caused double 'Unducking music' and double 'TTS response finished' log entries on every stop-word-triggered stop. Also move _pipeline_active = False inside the 'if not self._tts_played' branch in VOICE_ASSISTANT_RUN_END, so it is not cleared while TTS is still playing. Co-authored-by: Omar Amin <65174210+omaramin-2000@users.noreply.github.com>
This commit is contained in:
1 parent
fbc4e05fbd
commit
96fd54a008
1 file changed
+6
-2
@@ -220,9 +220,12 @@ class VoiceSatelliteProtocol(APIServer):
|
||||
self.play_tts()
|
||||
elif event_type == VoiceAssistantEventType.VOICE_ASSISTANT_RUN_END:
|
||||
self._is_streaming_audio = False
|
||||
self._pipeline_active = False
|
||||
if not self._tts_played:
|
||||
self._pipeline_active = False
|
||||
self._tts_finished()
|
||||
# When TTS is playing, keep _pipeline_active = True to block
|
||||
# false wake word detections from speaker audio feedback.
|
||||
# _tts_finished() callback will clear it when playback ends.
|
||||
|
||||
self._tts_played = False
|
||||
|
||||
@@ -417,9 +420,10 @@ class VoiceSatelliteProtocol(APIServer):
|
||||
self.state.tts_player.stop()
|
||||
_LOGGER.debug("Stopping timer finished sound")
|
||||
else:
|
||||
# tts_player.stop() invokes the done_callback (_tts_finished),
|
||||
# so we don't call _tts_finished() again explicitly.
|
||||
self.state.tts_player.stop()
|
||||
_LOGGER.debug("TTS response stopped manually")
|
||||
self._tts_finished()
|
||||
|
||||
def play_tts(self) -> None:
|
||||
if (not self._tts_url) or self._tts_played:
|
||||
|
||||
Reference in new issue
Block a user