Skip to content

Speech Dispatcher: Cancel queued speech on stop and interrupt - #158

Merged
ethindp merged 2 commits into
ethindp:masterfrom
orderofdan:speech-dispatcher-cancel
Oct 14, 2026
Merged

ethindp merged 2 commits into
ethindp:masterfrom
orderofdan:speech-dispatcher-cancel

Conversation

@orderofdan

Copy link
Copy Markdown
Contributor

stop() and the interrupting path in speak() called spd_stop, which ends only the message being spoken. Anything already queued then kept playing, and text spoken with interrupt set waited behind the queue instead of replacing it. Both now call spd_cancel, which also discards the client's queue. Orca's own Speech Dispatcher driver uses cancel for the same reason. spd_cancel is bound at run time like the other spd_ functions, in place of spd_stop, which nothing calls any more. This is the same kind of problem as #71 in the UIA backend.

The Speech Dispatcher Wine bridge (winelibs/speechd/bridge.cpp) had the same two spd_stop calls, so the second commit makes the same change there; the Spiel bridge already cancels. The bridge builds with Prism's winelib toolchain, as PRISM_BUILD_WINELIBS builds it, and passes clang-tidy (Wine 10.0, winegcc over GCC 14), but I haven't run it under Wine.

Tested on master (b68e9c9) on Debian 13 (x86_64), speech-dispatcher 0.12.1 from trixie-backports with the Eloquence and espeak-ng modules, built with GCC 14.2 and linted with clang-tidy 22:

  • Five lines spoken with interrupt off, then prism_backend_stop during the first: silence, and none of the others play. Before this change, the rest of the queue kept playing.
  • A line spoken with interrupt on while others are queued: heard at once, in place of the queue.

There's no regression test: this needs a running speech-dispatcher, and I couldn't see an existing pattern for testing the Linux backends. I'm happy to add one if you can point me at how you'd like it done.

spd_stop ends only the message being spoken, so speech the client had
already queued kept playing after a stop, and an interrupting speak was
queued behind it instead of replacing it. spd_cancel also discards the
client's queue.

Signed-off-by: Dan <[email protected]>
The Wine bridge had the same problem as the native backend: spd_stop
ends only the message being spoken, so queued speech kept playing after
a stop, and an interrupting speak was queued behind it. spd_cancel also
discards the client's queue.

Signed-off-by: Dan <[email protected]>
@ethindp
ethindp merged commit 2ad57f3 into ethindp:master Oct 14, 2026
61 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