From d76177c6f488aebe679353e9b72f910f4a6cc8e9 Mon Sep 17 00:00:00 2001 From: Sascha Cowley <16543535+SaschaCowley@users.noreply.github.com> Date: Fri, 13 Dec 2024 19:38:45 +1100 Subject: [PATCH] Fixed SAPI5 initialisation --- source/synthDrivers/sapi5.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/synthDrivers/sapi5.py b/source/synthDrivers/sapi5.py index a61e5ad9ee2..c39b35406b4 100644 --- a/source/synthDrivers/sapi5.py +++ b/source/synthDrivers/sapi5.py @@ -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 @@ -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