Skip to content

Commit

Permalink
ソングでspeakerの初期化時にuiをロックしないようにする
Browse files Browse the repository at this point in the history
  • Loading branch information
sigprogramming committed Dec 13, 2024
1 parent 7d2ef38 commit 9c2c52a
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 15 deletions.
1 change: 1 addition & 0 deletions src/store/audio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@ export const audioStore = createPartialStore<AudioStoreTypes>({
.INITIALIZE_ENGINE_SPEAKER({
engineId,
styleId,
uiLock: true,
})
.finally(() => {
mutations.SET_AUDIO_KEYS_WITH_INITIALIZING_SPEAKER({
Expand Down
32 changes: 19 additions & 13 deletions src/store/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,19 +334,25 @@ export const engineStore = createPartialStore<EngineStoreTypes>({
/**
* 指定した話者(スタイルID)に対してエンジン側の初期化を行い、即座に音声合成ができるようにする。
*/
async action({ actions }, { engineId, styleId }) {
await actions.ASYNC_UI_LOCK({
callback: () =>
actions
.INSTANTIATE_ENGINE_CONNECTOR({
engineId,
})
.then((instance) =>
instance.invoke("initializeSpeakerInitializeSpeakerPost")({
speaker: styleId,
}),
),
});
async action({ actions }, { engineId, styleId, uiLock }) {
const requestEngineToInitializeSpeaker = () =>
actions
.INSTANTIATE_ENGINE_CONNECTOR({
engineId,
})
.then((instance) =>
instance.invoke("initializeSpeakerInitializeSpeakerPost")({
speaker: styleId,
}),
);

if (uiLock) {
await actions.ASYNC_UI_LOCK({
callback: requestEngineToInitializeSpeaker,
});
} else {
await requestEngineToInitializeSpeaker();
}
},
},
VALIDATE_ENGINE_DIR: {
Expand Down
6 changes: 5 additions & 1 deletion src/store/singing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,11 @@ export const singingStore = createPartialStore<SingingStoreTypes>({
// 指定されたstyleIdに対して、エンジン側の初期化を行う
const isInitialized = await actions.IS_INITIALIZED_ENGINE_SPEAKER(singer);
if (!isInitialized) {
await actions.INITIALIZE_ENGINE_SPEAKER(singer);
await actions.INITIALIZE_ENGINE_SPEAKER({
engineId: singer.engineId,
styleId: singer.styleId,
uiLock: false,
});
}
},
},
Expand Down
6 changes: 5 additions & 1 deletion src/store/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1639,7 +1639,11 @@ export type EngineStoreTypes = {
};

INITIALIZE_ENGINE_SPEAKER: {
action(payload: { engineId: EngineId; styleId: StyleId }): void;
action(payload: {
engineId: EngineId;
styleId: StyleId;
uiLock: boolean;
}): void;
};

VALIDATE_ENGINE_DIR: {
Expand Down

0 comments on commit 9c2c52a

Please sign in to comment.