Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

複数エンジン対応:書き出し時の名前を修正 #992

Merged
merged 2 commits into from
Oct 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/store/audio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1652,15 +1652,15 @@ export const audioStore = createPartialStore<AudioStoreTypes>({
}
}

const characters = new Map<number, string>();
const characters = new Map<string, string>();

if (!getters.USER_ORDERED_CHARACTER_INFOS)
throw new Error("USER_ORDERED_CHARACTER_INFOS == undefined");

for (const characterInfo of getters.USER_ORDERED_CHARACTER_INFOS) {
for (const style of characterInfo.metas.styles) {
characters.set(
style.styleId,
`${style.engineId}:${style.styleId}`, // FIXME: 入れ子のMapにする
`${characterInfo.metas.speakerName}(${
style.styleName || "ノーマル"
})`
Expand All @@ -1671,8 +1671,14 @@ export const audioStore = createPartialStore<AudioStoreTypes>({
const texts: string[] = [];
for (const audioKey of state.audioKeys) {
const styleId = state.audioItems[audioKey].styleId;
const engineId = state.audioItems[audioKey].engineId;
if (!engineId) {
throw new Error("engineId is undefined");
}
const speakerName =
styleId !== undefined ? characters.get(styleId) + "," : "";
styleId !== undefined
? characters.get(`${engineId}:${styleId}`) + ","
: "";

texts.push(speakerName + state.audioItems[audioKey].text);
}
Expand Down