Skip to content

Commit 1c6a4fb

Browse files
authored
Merge d76177c into 82fefa5
2 parents 82fefa5 + d76177c commit 1c6a4fb

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

source/synthDrivers/sapi5.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import audioDucking
1515
from synthDriverHandler import SynthDriver, VoiceInfo, synthIndexReached, synthDoneSpeaking
1616
import config
17-
import nvwave
1817
from logHandler import log
1918
import weakref
2019
import languageHandler
@@ -205,9 +204,10 @@ def _initTts(self, voice=None):
205204
# Therefore, set the voice before setting the audio output.
206205
# Otherwise, we will get poor speech quality in some cases.
207206
self.tts.voice = voice
208-
outputDeviceID = nvwave.outputDeviceNameToID(config.conf["speech"]["outputDevice"], True)
209-
if outputDeviceID >= 0:
210-
self.tts.audioOutput = self.tts.getAudioOutputs()[outputDeviceID]
207+
for audioOutput in self.tts.GetAudioOutputs():
208+
if audioOutput.GetDescription() == config.conf["speech"]["outputDevice"]:
209+
self.tts.audioOutput = audioOutput
210+
break
211211
self._eventsConnection = comtypes.client.GetEvents(self.tts, SapiSink(weakref.ref(self)))
212212
self.tts.EventInterests = (
213213
SpeechVoiceEvents.StartInputStream | SpeechVoiceEvents.Bookmark | SpeechVoiceEvents.EndInputStream

0 commit comments

Comments
 (0)