Start work on wrapping the WinRT speech APIs

They give access to more voices, but whether they will be workable
remains to be seen.
This commit is contained in:
Kovid Goyal 2023-01-11 13:19:39 +05:30
parent ceb72752e4
commit 6dd38d512c
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
5 changed files with 53 additions and 2 deletions

View File

@ -184,6 +184,14 @@
"libraries": "SAPI Ole32", "libraries": "SAPI Ole32",
"cflags": "/X" "cflags": "/X"
}, },
{
"name": "winspeech",
"only": "windows",
"headers": "calibre/utils/cpp_binding.h calibre/utils/windows/common.h",
"sources": "calibre/utils/windows/winspeech.cpp",
"libraries": "shlwapi runtimeobject",
"cflags": "/X"
},
{ {
"name": "wpd", "name": "wpd",
"only": "windows", "only": "windows",

View File

@ -261,7 +261,7 @@ class ExtDev(Command):
try: try:
path = path.format(ext) path = path.format(ext)
src = os.path.join(ext_dir, os.path.basename(path)) src = os.path.join(ext_dir, os.path.basename(path))
subprocess.check_call(['ssh', '-S', control_path, host, 'chmod', '+w', f'"{path}"']) subprocess.check_call(['ssh', '-S', control_path, host, 'chmod', '+wx', f'"{path}"'])
with open(src, 'rb') as f: with open(src, 'rb') as f:
p = subprocess.Popen(['ssh', '-S', control_path, host, f'cat - > "{path}"'], stdin=subprocess.PIPE) p = subprocess.Popen(['ssh', '-S', control_path, host, f'cat - > "{path}"'], stdin=subprocess.PIPE)
p.communicate(f.read()) p.communicate(f.read())

View File

@ -269,7 +269,7 @@ class ExtensionsImporter:
'uchardet', 'uchardet',
) )
if iswindows: if iswindows:
extra = ('winutil', 'wpd', 'winfonts', 'winsapi') extra = ('winutil', 'wpd', 'winfonts', 'winsapi', 'winspeech')
elif ismacos: elif ismacos:
extra = ('usbobserver', 'cocoa', 'libusb', 'libmtp') extra = ('usbobserver', 'cocoa', 'libusb', 'libmtp')
elif isfreebsd or ishaiku or islinux: elif isfreebsd or ishaiku or islinux:

View File

@ -0,0 +1,32 @@
/*
* winspeech.cpp
* Copyright (C) 2023 Kovid Goyal <kovid at kovidgoyal.net>
*
* Distributed under terms of the GPL3 license.
*/
#include "common.h"
#define M(name, args) { #name, name, args, ""}
static PyMethodDef methods[] = {
{NULL, NULL, 0, NULL}
};
#undef M
static int
exec_module(PyObject *m) {
return 0;
}
static PyModuleDef_Slot slots[] = { {Py_mod_exec, (void*)exec_module}, {0, NULL} };
static struct PyModuleDef module_def = {PyModuleDef_HEAD_INIT};
CALIBRE_MODINIT_FUNC PyInit_winspeech(void) {
module_def.m_name = "winspeech";
module_def.m_doc = "Windows Speech API wrapper";
module_def.m_methods = methods;
module_def.m_slots = slots;
return PyModuleDef_Init(&module_def);
}

View File

@ -0,0 +1,11 @@
#!/usr/bin/env python
# License: GPLv3 Copyright: 2023, Kovid Goyal <kovid at kovidgoyal.net>
import calibre_extensions.winspeech as winspeech
winspeech
def develop():
pass