From 28aae0158f5c78f450539f2572c54c8d1a996724 Mon Sep 17 00:00:00 2001 From: miteruzo Date: Sat, 2 Dec 2023 19:42:27 +0900 Subject: [PATCH] =?UTF-8?q?=E9=9F=B3=E5=A3=B0=E8=A8=98=E5=8F=B7=E5=88=97?= =?UTF-8?q?=E3=81=AB=E5=A4=89=E6=8F=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aques.py | 11 ++++++++++- main.py | 6 ++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/aques.py b/aques.py index bfd2baa..c52c93c 100644 --- a/aques.py +++ b/aques.py @@ -14,10 +14,19 @@ class Aques: with open (phont_file, 'rb') as f: phont = f.read () + aqkoe = cdll.LoadLibrary ('libAqKanji2Koe.so') + dic_path: str = '.' + err = c_int (0) + aqkoe.AqKanji2Koe_Create.restype = c_void_p + handle = aqkoe.AqKanji2Koe_Create (dic_path, byref (err)) + koe: str = '' + aqkoe.AqKanji2Koe_Convert.restype = c_int + aqkoe.AqKanji2Koe_Convert (handle, text.encode ('utf-8'), koe, 4096) + aqtk = cdll.LoadLibrary ('libAquesTalk2Eva.so') aqtk.AquesTalk2_Synthe_Utf8.restype = POINTER (ARRAY (c_ubyte, 0)) size = c_int (0) - wav_p = aqtk.AquesTalk2_Synthe_Utf8 (text.encode ('utf-8'), speed, + wav_p = aqtk.AquesTalk2_Synthe_Utf8 (koe.encode ('utf-8'), speed, byref (size), phont) if not bool (wav_p): diff --git a/main.py b/main.py index 1e0502f..1805380 100644 --- a/main.py +++ b/main.py @@ -47,8 +47,12 @@ class Main: screen.blit (nizika_font.render ( answer, True, (192, 0, 0)), (100, 150)) + pygame.display.update () + noon.play () + time.sleep (2) + wav: bytearray | None = Aques.main (answer) if wav is not None: with open ('./nizika_talking.wav', 'wb') as f: @@ -56,8 +60,6 @@ class Main: playsound ('./nizika_talking.wav') - pygame.display.update () - time.sleep (10) pygame.display.update ()