diff --git a/aques.py b/aques.py index 3a625bc..c3755d8 100644 --- a/aques.py +++ b/aques.py @@ -1,4 +1,5 @@ from ctypes import * +import subprocess class Aques: @@ -14,14 +15,9 @@ class Aques: with open (phont_file, 'rb') as f: phont = f.read () - aqkoe = cdll.LoadLibrary ('libAqKanji2Koe.so') - dic_path: str = './aq_dic' - err = c_int (0) - aqkoe.AqKanji2Koe_Create.restype = c_void_p - handle = aqkoe.AqKanji2Koe_Create (dic_path.encode ('utf-8'), byref (err)) - koe: str = '' - aqkoe.AqKanji2Koe_Convert.restype = c_int - aqkoe.AqKanji2Koe_Convert (handle, text.encode ('utf-8'), koe, 4096) + p = subprocess.Popen ('./aques', stdin = subprocess.PIPE, + stdout = subprocess.PIPE) + koe = p.communicate (text.encode ())[0].decode () aqtk = cdll.LoadLibrary ('libAquesTalk2Eva.so') aqtk.AquesTalk2_Synthe_Utf8.restype = POINTER (ARRAY (c_ubyte, 0))