Skip to content

Commit

Permalink
Fixed SAPI5 initialisation
Browse files Browse the repository at this point in the history
  • Loading branch information
SaschaCowley committed Dec 13, 2024
1 parent 82fefa5 commit d76177c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions source/synthDrivers/sapi5.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import audioDucking
from synthDriverHandler import SynthDriver, VoiceInfo, synthIndexReached, synthDoneSpeaking
import config
import nvwave
from logHandler import log
import weakref
import languageHandler
Expand Down Expand Up @@ -205,9 +204,10 @@ def _initTts(self, voice=None):
# Therefore, set the voice before setting the audio output.
# Otherwise, we will get poor speech quality in some cases.
self.tts.voice = voice
outputDeviceID = nvwave.outputDeviceNameToID(config.conf["speech"]["outputDevice"], True)
if outputDeviceID >= 0:
self.tts.audioOutput = self.tts.getAudioOutputs()[outputDeviceID]
for audioOutput in self.tts.GetAudioOutputs():
if audioOutput.GetDescription() == config.conf["speech"]["outputDevice"]:
self.tts.audioOutput = audioOutput
break
self._eventsConnection = comtypes.client.GetEvents(self.tts, SapiSink(weakref.ref(self)))
self.tts.EventInterests = (
SpeechVoiceEvents.StartInputStream | SpeechVoiceEvents.Bookmark | SpeechVoiceEvents.EndInputStream
Expand Down

0 comments on commit d76177c

Please sign in to comment.