From 880de38875db74a175979f043a8b631872d9c632 Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Fri, 27 Jan 2023 20:35:52 +0900 Subject: [PATCH] =?UTF-8?q?Add:=20GPU=E3=83=A2=E3=83=BC=E3=83=89=E3=81=A7?= =?UTF-8?q?=E3=81=AE=E3=82=A8=E3=83=B3=E3=82=B8=E3=83=B3=E3=82=AF=E3=83=A9?= =?UTF-8?q?=E3=83=83=E3=82=B7=E3=83=A5=E6=99=82=E3=81=ABCPU=E3=81=AB?= =?UTF-8?q?=E5=88=87=E3=82=8A=E6=8F=9B=E3=81=88=E3=81=A7=E3=81=8D=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/background/engineManager.ts | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/src/background/engineManager.ts b/src/background/engineManager.ts index ad204c2104..9e30083d98 100644 --- a/src/background/engineManager.ts +++ b/src/background/engineManager.ts @@ -266,7 +266,7 @@ export class EngineManager { ); }); - engineProcess.on("close", (code, signal) => { + engineProcess.on("close", async (code, signal) => { log.info( `ENGINE ${engineId}: Process terminated due to receipt of signal ${signal}` ); @@ -276,9 +276,30 @@ export class EngineManager { ipcMainSend(win, "DETECTED_ENGINE_ERROR", { engineId }); const dialogMessage = engineInfos.length === 1 - ? "音声合成エンジンが異常終了しました。エンジンを再起動してください。" - : `${engineInfo.name}が異常終了しました。エンジンを再起動してください。`; - dialog.showErrorBox("音声合成エンジンエラー", dialogMessage); + ? "音声合成エンジンが異常終了しました。" + : `${engineInfo.name}が異常終了しました。`; + if (this.store.get("engineSetting")[engineId].useGpu) { + const dialogResult = await dialog.showMessageBox({ + title: "音声合成エンジンエラー", + message: + dialogMessage + + "\n現在、GPUモードで起動しています。CPUモードで再起動しますか?", + type: "error", + buttons: ["いいえ", "はい"], + cancelId: 0, + defaultId: 1, + noLink: true, + }); + if (dialogResult.response === 1) { + this.store.set(`engineSetting.${engineId}.useGpu`, false); + this.runEngine(engineId, win); + } + } else { + dialog.showErrorBox( + "音声合成エンジンエラー", + dialogMessage + "\nエンジンを再起動してください。" + ); + } } }); }