From a7a60da2603388e29e83bf2fb1bf45902e1e6e0f Mon Sep 17 00:00:00 2001 From: himeditator mac Date: Wed, 30 Jul 2025 00:16:54 +0800 Subject: [PATCH] =?UTF-8?q?fix(engine):=20=E5=AD=97=E5=B9=95=E5=BC=95?= =?UTF-8?q?=E6=93=8E=E5=90=AF=E5=8A=A8=E8=B7=AF=E5=BE=84=E9=80=82=E9=85=8D?= =?UTF-8?q?=E3=80=81=E9=9F=B3=E9=A2=91=E9=87=8D=E9=87=87=E6=A0=B7=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- engine/utils/audioprcs.py | 7 ++++--- src/main/utils/CaptionEngine.ts | 7 ++++++- src/renderer/src/i18n/lang/en.ts | 2 +- src/renderer/src/i18n/lang/ja.ts | 2 +- src/renderer/src/i18n/lang/zh.ts | 2 +- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/engine/utils/audioprcs.py b/engine/utils/audioprcs.py index a4362a2..e083c5e 100644 --- a/engine/utils/audioprcs.py +++ b/engine/utils/audioprcs.py @@ -39,15 +39,15 @@ def resample_chunk_mono(chunk: bytes, channels: int, orig_sr: int, target_sr: in 单通道音频数据块 """ if channels == 1: - chunk_mono = chunk + chunk_mono = np.frombuffer(chunk, dtype=np.int16) + chunk_mono = chunk_mono.astype(np.float32) else: # (length * channels,) chunk_np = np.frombuffer(chunk, dtype=np.int16) # (length, channels) chunk_np = chunk_np.reshape(-1, channels) # (length,) - chunk_mono_f = np.mean(chunk_np.astype(np.float32), axis=1) - chunk_mono = chunk_mono_f.astype(np.int16) + chunk_mono = np.mean(chunk_np.astype(np.float32), axis=1) ratio = target_sr / orig_sr chunk_mono_r = samplerate.resample(chunk_mono, ratio, converter_type=mode) @@ -69,6 +69,7 @@ def resample_mono_chunk(chunk: bytes, orig_sr: int, target_sr: int, mode="sinc_b 单通道音频数据块 """ chunk_np = np.frombuffer(chunk, dtype=np.int16) + chunk_np = chunk_np.astype(np.float32) ratio = target_sr / orig_sr chunk_r = samplerate.resample(chunk_np, ratio, converter_type=mode) chunk_r = np.round(chunk_r).astype(np.int16) diff --git a/src/main/utils/CaptionEngine.ts b/src/main/utils/CaptionEngine.ts index 93cd503..3d164e1 100644 --- a/src/main/utils/CaptionEngine.ts +++ b/src/main/utils/CaptionEngine.ts @@ -54,7 +54,12 @@ export class CaptionEngine { } } else { - this.appPath = path.join(process.resourcesPath, 'engine', 'main.exe') + if(process.platform === 'win32') { + this.appPath = path.join(process.resourcesPath, 'engine', 'main.exe') + } + else { + this.appPath = path.join(process.resourcesPath, 'engine', 'main') + } } this.command.push('-a', allConfig.controls.audio ? '1' : '0') diff --git a/src/renderer/src/i18n/lang/en.ts b/src/renderer/src/i18n/lang/en.ts index 24376af..30136f6 100644 --- a/src/renderer/src/i18n/lang/en.ts +++ b/src/renderer/src/i18n/lang/en.ts @@ -119,7 +119,7 @@ export default { "projLink": "Project Link", "manual": "User Manual", "engineDoc": "Caption Engine Manual", - "date": "July 29, 2025" + "date": "July 30, 2025" } }, log: { diff --git a/src/renderer/src/i18n/lang/ja.ts b/src/renderer/src/i18n/lang/ja.ts index 0f91142..9dcde86 100644 --- a/src/renderer/src/i18n/lang/ja.ts +++ b/src/renderer/src/i18n/lang/ja.ts @@ -119,7 +119,7 @@ export default { "projLink": "プロジェクトリンク", "manual": "ユーザーマニュアル", "engineDoc": "字幕エンジンマニュアル", - "date": "2025 年 7 月 29 日" + "date": "2025 年 7 月 30 日" } }, log: { diff --git a/src/renderer/src/i18n/lang/zh.ts b/src/renderer/src/i18n/lang/zh.ts index ddb52b5..46edb1d 100644 --- a/src/renderer/src/i18n/lang/zh.ts +++ b/src/renderer/src/i18n/lang/zh.ts @@ -119,7 +119,7 @@ export default { "projLink": "项目链接", "manual": "用户手册", "engineDoc": "字幕引擎手册", - "date": "2025 年 7 月 29 日" + "date": "2025 年 7 月 30 日" } }, log: {