From 78efdb5bd04a6cbee0b929c2fc2fe055e694844e Mon Sep 17 00:00:00 2001 From: X-20A <155217226+X-20A@users.noreply.github.com> Date: Tue, 26 Nov 2024 06:56:22 +0900 Subject: [PATCH] =?UTF-8?q?=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/App.vue | 8 +++----- src/store/singing.ts | 31 +++++++++++++------------------ src/store/type.ts | 2 +- 3 files changed, 17 insertions(+), 24 deletions(-) diff --git a/src/components/App.vue b/src/components/App.vue index 284c6212fa..0b19444554 100644 --- a/src/components/App.vue +++ b/src/components/App.vue @@ -99,11 +99,9 @@ watchEffect(() => { // 再生デバイスの初期化と変更の監視 watchEffect(() => { - store.actions - .APPLY_DEVICE_ID({ device: store.state.savingSetting.audioOutputDevice }) - .catch((e) => { - console.error(e); - }); + void store.actions.APPLY_DEVICE_ID_TO_AUDIO_CONTEXT({ + device: store.state.savingSetting.audioOutputDevice, + }); }); // ソフトウェアを初期化 diff --git a/src/store/singing.ts b/src/store/singing.ts index 0a322926e1..8fc34c76fa 100644 --- a/src/store/singing.ts +++ b/src/store/singing.ts @@ -754,21 +754,6 @@ const getSelectedTrackWithFallback = (partialState: { return getOrThrow(partialState.tracks, partialState._selectedTrackId); }; -// AudioContextに再生デバイスのIDを設定 -const applyDeviceId = async (device: string) => { - if (audioContext) { - const sinkId = device === "default" ? "" : device; - audioContext.setSinkId(sinkId).catch((err: unknown) => { - void showAlertDialog({ - type: "error", - title: "エラー", - message: "再生デバイスが見つかりません", - }); - throw err; - }); - } -}; - export const singingStoreState: SingingStoreState = { tpqn: DEFAULT_TPQN, tempos: [createDefaultTempo(0)], @@ -1698,9 +1683,19 @@ export const singingStore = createPartialStore({ }, }, - APPLY_DEVICE_ID: { - async action(_, { device }) { - await applyDeviceId(device); + APPLY_DEVICE_ID_TO_AUDIO_CONTEXT: { + action(_, { device }) { + if (audioContext) { + const sinkId = device === "default" ? "" : device; + audioContext.setSinkId(sinkId).catch((err: unknown) => { + void showAlertDialog({ + type: "error", + title: "エラー", + message: "再生デバイスが見つかりません", + }); + throw err; + }); + } }, }, diff --git a/src/store/type.ts b/src/store/type.ts index 49932619b8..50c523d22a 100644 --- a/src/store/type.ts +++ b/src/store/type.ts @@ -1327,7 +1327,7 @@ export type SingingStoreTypes = { action(): void; }; - APPLY_DEVICE_ID: { + APPLY_DEVICE_ID_TO_AUDIO_CONTEXT: { action(payload: { device: string }): void; }; };