Speak aloud implementation for macOS

This commit is contained in:
Kovid Goyal 2020-11-18 22:03:33 +05:30
parent 084de4c88d
commit a83ea13162
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 18 additions and 2 deletions

View File

@ -7,7 +7,7 @@ from calibre.constants import iswindows, ismacos
if iswindows:
from .windows import Client
elif ismacos:
pass
from .macos import Client
else:
from .linux import Client
Client
Client

View File

@ -0,0 +1,16 @@
#!/usr/bin/env python
# vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
class Client:
def __init__(self):
from calibre_extensions.cocoa import NSSpeechSynthesizer
self.nsss = NSSpeechSynthesizer()
def __del__(self):
self.nsss = None
def speak_simple_text(self, text):
self.nsss.speak(text)