Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing guard condition in sapi5 driver #221

Open
Vincent-Stragier opened this issue Feb 16, 2022 · 1 comment
Open

Missing guard condition in sapi5 driver #221

Vincent-Stragier opened this issue Feb 16, 2022 · 1 comment

Comments

@Vincent-Stragier
Copy link

Vincent-Stragier commented Feb 16, 2022

I do not see how the method runAndWait() can return, there seems to be no guard condition in the startLoop method.

def startLoop(self):
first = True
self._looping = True
while self._looping:
if first:
self._proxy.setBusy(False)
first = False
pythoncom.PumpWaitingMessages()
time.sleep(0.05)

Looking at pyttsx3/drivers/espeak.py driver, I altered the method startLoop in pyttsx3/drivers/sapi5.py:

    def startLoop(self):
        first = True
        self._looping = True
        while self._looping:
            if first:
                self._proxy.setBusy(False)
                first = False
            if not pythoncom.PumpWaitingMessages() and self._looping:
                self._stopping = False
                self._proxy.notify('finished-utterance', completed=False)
                self._proxy.setBusy(False)
            time.sleep(0.05)
@lehuymanhtan
Copy link

Thank. This helped me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants