fix: restore speech dispatcher interruption

This commit is contained in:
2026-04-09 11:24:20 -04:00
parent 56030567ed
commit fb5684f8ef
2 changed files with 46 additions and 9 deletions
+3 -9
View File
@@ -614,15 +614,6 @@ class SpeechServer(speechserver.SpeechServer):
if not text:
return
# In order to re-enable this, a potentially non-trivial amount of work
# will be needed to ensure multiple utterances sent to speech.speak
# do not result in the intial utterances getting cut off before they
# can be heard by the user. Anyone needing to interrupt speech can
# do so via speech.stop -- or better yet, by using the default script
# method's presentationInterrupt.
#if interrupt:
# self._cancel()
# "We will not interrupt a key echo in progress." (Said the comment in
# speech.py where these next two lines used to live. But the code here
# suggests we haven't been doing anything with the lastKeyEchoTime in
@@ -630,6 +621,9 @@ class SpeechServer(speechserver.SpeechServer):
if self._lastKeyEchoTime:
interrupt = interrupt and (time.time() - self._lastKeyEchoTime) > 0.5
if interrupt:
self._cancel()
if len(text) == 1:
tokens = ["SPEECH DISPATCHER: Speaking '", text.replace("\n", "\\n"), "' as char"]
debug.printTokens(debug.LEVEL_INFO, tokens, True)