Skip to content

Commit a97baf2

Browse files
authored
Fix SAPI5 (#18473)
Fixup of #18352. Summary of the issue: When WASAPI is turned off, bookmark events are not handled properly. Description of user facing changes: Users might not notice that, because although the bookmarks are not handled in time, they are still processed at the end of the utterance. Description of developer facing changes: None Description of development approach: Code that handles the bookmark events when WASAPI is off is added.
1 parent efff5e6 commit a97baf2

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

source/synthDrivers/sapi5.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,15 @@ def StartStream(self, streamNum: int, pos: int):
202202

203203
def Bookmark(self, streamNum: int, pos: int, bookmark: str, bookmarkId: int):
204204
synth = self.synthRef()
205-
if not synth.isSpeaking or not synth.player:
205+
if not synth.isSpeaking:
206206
return
207-
# Bookmark event is raised before the audio after that point.
208-
# Queue an IndexReached event at this point.
209-
synth.player.feed(None, 0, lambda: self.onIndexReached(streamNum, bookmarkId))
207+
if synth.player:
208+
# Bookmark event is raised before the audio after that point.
209+
# Queue an IndexReached event at this point.
210+
synth.player.feed(None, 0, lambda: self.onIndexReached(streamNum, bookmarkId))
211+
else:
212+
# Bookmark notifications should be sent immediately when WASAPI is off.
213+
self.onIndexReached(streamNum, bookmarkId)
210214

211215
def EndStream(self, streamNum: int, pos: int):
212216
synth = self.synthRef()

user_docs/en/changes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ There have also been a number of other fixes and improvements, including to mous
3939
* Unassigned commands have been added to open the NVDA settings dialog in the following categories: Vision, Windows OCR, Add-on Store and Advanced. (#18313, @CyrilleB79)
4040
* Introduced support for Windows 11 Voice Access, including reporting dictated text and microphone status from everywhere (requires NVDA to be installed). (#16862, #17384, @josephsl)
4141
* Support for the NLS eReader Zoomax braille display has been added. (#15863, @florin-trutiu)
42+
* A checkbox has been added in the speech settings to allow users to disable WASAPI for SAPI5 voices. (#18309, @gexgd0419)
4243

4344
### Changes
4445

0 commit comments

Comments
 (0)