Skip to content

Commit

Permalink
Small fixes to SAPI5 (#17622)
Browse files Browse the repository at this point in the history
Some small fixes to the SAPI5 code part that I wrote. Those things didn't cause crashes or obvious errors, so they slipped by.

Description of user facing changes
None

Description of development approach
plibNewPosition is a pointer, so writing to plibNewPosition->QuadPart should be plibNewPosition[0].QuadPart in Python. This is now corrected.

synth.player.idle() is moved to before the "trigger all untriggered bookmarks" part, to let the audio and the contained bookmarks finish first.
  • Loading branch information
gexgd0419 authored Jan 15, 2025
1 parent be58ca5 commit 0a31499
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source/synthDrivers/sapi5.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def IStream_RemoteSeek(
if dwOrigin == 1 and dlibMove.QuadPart == 0:
# SAPI is querying the current position.
if plibNewPosition:
plibNewPosition.QuadPart = self._writtenBytes
plibNewPosition[0].QuadPart = self._writtenBytes
return hresult.S_OK
return hresult.E_NOTIMPL

Expand Down Expand Up @@ -194,13 +194,13 @@ def Bookmark(self, streamNum: int, pos: int, bookmark: str, bookmarkId: int):

def EndStream(self, streamNum: int, pos: int):
synth = self.synthRef()
synth.player.idle()
# trigger all untriggered bookmarks
if streamNum in synth._streamBookmarks:
for bookmark in synth._streamBookmarks[streamNum]:
synthIndexReached.notify(synth=synth, index=bookmark)
del synth._streamBookmarks[streamNum]
synth.isSpeaking = False
synth.player.idle()
synthDoneSpeaking.notify(synth=synth)

def onIndexReached(self, streamNum: int, index: int):
Expand Down

0 comments on commit 0a31499

Please sign in to comment.