fix: play stop sound immediately on release (#426)

This commit is contained in:
juanfradb
2026-05-30 14:37:53 -07:00
committed by GitHub
parent 722fc23403
commit a267f500dd
2 changed files with 21 additions and 3 deletions
@@ -1768,6 +1768,10 @@ class SpeechRecognitionManager:
# Stop recording FIRST to prevent capturing the stop sound
self.should_record = False
# Give immediate release feedback. The recorder may still finish one
# in-flight chunk, so the stop-sound guard below keeps the cue out.
play_stop_sound()
# Wait for audio thread to finish recording and enqueue any pending audio
# This is critical to prevent race condition where recognition thread exits
# before the final audio segment is enqueued
@@ -1791,9 +1795,6 @@ class SpeechRecognitionManager:
self._enqueue_audio_segment(self.audio_buffer)
self.audio_buffer = []
# Now play the stop sound (after recording has stopped)
play_stop_sound()
# Wake up recognition thread so it can drain queued segments and stop
self._signal_recognition_stop()