Skip to content

Commit 0d08b86

Browse files
ソング:Speakerの初期化時にUIをロックしないようにする (#2413)
1 parent 84bd237 commit 0d08b86

File tree

4 files changed

+34
-19
lines changed

4 files changed

+34
-19
lines changed

src/store/audio.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,9 +570,10 @@ export const audioStore = createPartialStore<AudioStoreTypes>({
570570
audioKeys,
571571
});
572572
await actions
573-
.INITIALIZE_ENGINE_SPEAKER({
573+
.INITIALIZE_ENGINE_CHARACTER({
574574
engineId,
575575
styleId,
576+
uiLock: true,
576577
})
577578
.finally(() => {
578579
mutations.SET_AUDIO_KEYS_WITH_INITIALIZING_SPEAKER({

src/store/engine.ts

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -330,23 +330,29 @@ export const engineStore = createPartialStore<EngineStoreTypes>({
330330
},
331331
},
332332

333-
INITIALIZE_ENGINE_SPEAKER: {
333+
INITIALIZE_ENGINE_CHARACTER: {
334334
/**
335-
* 指定した話者(スタイルID)に対してエンジン側の初期化を行い、即座に音声合成ができるようにする。
335+
* 指定したキャラクター(スタイルID)に対してエンジン側の初期化を行い、即座に音声合成ができるようにする。
336336
*/
337-
async action({ actions }, { engineId, styleId }) {
338-
await actions.ASYNC_UI_LOCK({
339-
callback: () =>
340-
actions
341-
.INSTANTIATE_ENGINE_CONNECTOR({
342-
engineId,
343-
})
344-
.then((instance) =>
345-
instance.invoke("initializeSpeakerInitializeSpeakerPost")({
346-
speaker: styleId,
347-
}),
348-
),
349-
});
337+
async action({ actions }, { engineId, styleId, uiLock }) {
338+
const requestEngineToInitializeCharacter = () =>
339+
actions
340+
.INSTANTIATE_ENGINE_CONNECTOR({
341+
engineId,
342+
})
343+
.then((instance) =>
344+
instance.invoke("initializeSpeakerInitializeSpeakerPost")({
345+
speaker: styleId,
346+
}),
347+
);
348+
349+
if (uiLock) {
350+
await actions.ASYNC_UI_LOCK({
351+
callback: requestEngineToInitializeCharacter,
352+
});
353+
} else {
354+
await requestEngineToInitializeCharacter();
355+
}
350356
},
351357
},
352358
VALIDATE_ENGINE_DIR: {

src/store/singing.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,11 @@ export const singingStore = createPartialStore<SingingStoreTypes>({
823823
// 指定されたstyleIdに対して、エンジン側の初期化を行う
824824
const isInitialized = await actions.IS_INITIALIZED_ENGINE_SPEAKER(singer);
825825
if (!isInitialized) {
826-
await actions.INITIALIZE_ENGINE_SPEAKER(singer);
826+
await actions.INITIALIZE_ENGINE_CHARACTER({
827+
engineId: singer.engineId,
828+
styleId: singer.styleId,
829+
uiLock: false,
830+
});
827831
}
828832
},
829833
},

src/store/type.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1638,8 +1638,12 @@ export type EngineStoreTypes = {
16381638
action(payload: { engineId: EngineId; styleId: StyleId }): Promise<boolean>;
16391639
};
16401640

1641-
INITIALIZE_ENGINE_SPEAKER: {
1642-
action(payload: { engineId: EngineId; styleId: StyleId }): void;
1641+
INITIALIZE_ENGINE_CHARACTER: {
1642+
action(payload: {
1643+
engineId: EngineId;
1644+
styleId: StyleId;
1645+
uiLock: boolean;
1646+
}): void;
16431647
};
16441648

16451649
VALIDATE_ENGINE_DIR: {

0 commit comments

Comments
 (0)