Skip to content

Don't complete speech a second time when the engine reports stopping after an interrupt - #110

Merged
trypsynth merged 1 commit into
trypsynth:masterfrom
aaron-gh:stale-speech-completions
Oct 8, 2026
Merged

trypsynth merged 1 commit into
trypsynth:masterfrom
aaron-gh:stale-speech-completions

Conversation

@aaron-gh

@aaron-gh aaron-gh commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

When something interrupts speech, such as touching the screen, the speech controller completes the current item itself: it tells its observers, releases audio focus, and clears the current item. The speech engine then reports that the utterance stopped. With no current item, that report wasn't recognised as stale, so speech was completed again: "Completed speech while already completed!" was logged, audio focus was released two or three times in a row, and observers were told twice.

Now completing speech that has already completed does nothing, except that a pause is still reported to observers, since that is only known when the engine's stop arrives.

Testing

  • On an Android 16 emulator, touching the screen during speech no longer logs the error, and audio focus requests and releases alternate. Before, three releases came in a row.
  • Pausing and resuming with a two-finger tap, and continuous reading, still work.
  • Unit tests and lint pass.

aaron-gh added a commit to aaron-gh/backtalk that referenced this pull request Oct 8, 2026
@trypsynth
trypsynth merged commit 93795f4 into trypsynth:master Oct 8, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants