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

ADD: AudioItemにSpeakerIdを追加 #1092

Merged
merged 24 commits into from
Feb 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
981d07d
ADD: AudioItemにspeakerIdを追加
sabonerune Jan 4, 2023
7292b6b
FIX: Voiceを渡す関数名を変更、COMMAND_PUT_TEXTSにVoiceを渡すように
sabonerune Jan 16, 2023
a1dfffb
FIX: プロジェクトファイルの読み込みタイミングを変更
sabonerune Jan 19, 2023
422cd8d
Merge branch 'main' into working/add-speaker-id
sabonerune Jan 24, 2023
a9a86cd
ENH: プロジェクトファイルをエンジンが起動した後に読み込まれるようにする
sabonerune Jan 25, 2023
7b8e4c6
FIX: パラメーターの複製を除去
sabonerune Jan 26, 2023
122ba97
FIX: ファイルパスをpropで渡すようにした
sabonerune Jan 26, 2023
ef50cc9
ENH: LOAD_PROJECT_FILEの成否が呼び出し側から分かるようにする
sabonerune Jan 26, 2023
2a2894d
ENH: プロジェクトを読み込んだ時のAudioCellの初期化を改良
sabonerune Jan 26, 2023
351dc8c
FIX: 読み込み中のプロジェクトファイル名の表示を廃止
sabonerune Jan 26, 2023
d3e7ce9
Merge branch 'main' into add-speaker-id
sabonerune Jan 27, 2023
efa69a9
Merge branch 'load-project-after-start-engine' into add-speaker-id
sabonerune Jan 27, 2023
bade1ea
ENH: AudioItemにVoiceを持たせる
sabonerune Jan 27, 2023
984a800
ADD: マイグレーション実装
sabonerune Jan 29, 2023
2d64a9d
FIX: GENERATE_AUDIO_ITEMの引数をVoiceへ
sabonerune Jan 30, 2023
7989f06
FIX: バージョンを変更
sabonerune Feb 1, 2023
b11fa26
Merge branch 'main' into add-speaker-id
sabonerune Feb 2, 2023
d59cf5c
FIX: マージのミス修正
sabonerune Feb 3, 2023
9221044
FIX: characters >name2Voice
sabonerune Feb 5, 2023
d2eac68
audioItem.voicewo
sabonerune Feb 5, 2023
2edd699
FIX: 分割代入を使用
sabonerune Feb 5, 2023
120d323
FIX: chracterinfoのundefinedチェック
sabonerune Feb 5, 2023
2bafe7d
FIX: audioItem.voiceを何度も書かないように
sabonerune Feb 5, 2023
72be04c
FIX: voiceComputedに変更
sabonerune Feb 6, 2023
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
21 changes: 4 additions & 17 deletions src/components/AudioCell.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,9 @@ const uiLocked = computed(() => store.getters.UI_LOCKED);

const selectedVoice = computed<Voice | undefined>({
get() {
const engineId = audioItem.value.engineId;
const styleId = audioItem.value.styleId;
const { engineId, styleId } = audioItem.value.voice;

if (
engineId == undefined ||
styleId == undefined ||
!store.state.engineIds.some((storeEngineId) => storeEngineId === engineId)
)
return undefined;
Expand All @@ -110,10 +107,9 @@ const selectedVoice = computed<Voice | undefined>({
},
set(voice: Voice | undefined) {
if (voice == undefined) return;
store.dispatch("COMMAND_CHANGE_STYLE_ID", {
store.dispatch("COMMAND_CHANGE_VOICE", {
audioKey: props.audioKey,
engineId: voice.engineId,
styleId: voice.styleId,
voice,
});
},
});
Expand Down Expand Up @@ -179,18 +175,9 @@ const pasteOnAudioCell = async (event: ClipboardEvent) => {
await pushAudioText();
}

const engineId = audioItem.value.engineId;
if (engineId === undefined)
throw new Error("assert engineId !== undefined");

const styleId = audioItem.value.styleId;
if (styleId === undefined)
throw new Error("assert styleId !== undefined");

const audioKeys = await store.dispatch("COMMAND_PUT_TEXTS", {
texts,
engineId,
styleId,
voice: audioItem.value.voice,
prevAudioKey,
});
if (audioKeys)
Expand Down
8 changes: 5 additions & 3 deletions src/components/AudioDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,11 @@ const $q = useQuasar();

const supportedFeatures = computed(
() =>
(audioItem.value?.engineId &&
store.state.engineIds.some((id) => id === audioItem.value.engineId) &&
store.state.engineManifests[audioItem.value?.engineId]
(audioItem.value?.voice.engineId &&
store.state.engineIds.some(
(id) => id === audioItem.value.voice.engineId
) &&
store.state.engineManifests[audioItem.value.voice.engineId]
.supportedFeatures) as EngineManifest["supportedFeatures"] | undefined
);

Expand Down
24 changes: 9 additions & 15 deletions src/components/AudioInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -507,9 +507,10 @@ const query = computed(() => audioItem.value?.query);

const supportedFeatures = computed(
() =>
(audioItem.value?.engineId &&
store.state.engineIds.some((id) => id === audioItem.value.engineId) &&
store.state.engineManifests[audioItem.value?.engineId]
(store.state.engineIds.some(
(id) => id === audioItem.value.voice.engineId
) &&
store.state.engineManifests[audioItem.value.voice.engineId]
.supportedFeatures) as EngineManifest["supportedFeatures"] | undefined
);

Expand Down Expand Up @@ -652,14 +653,10 @@ const morphingTargetEngines = store.getters.MORPHING_SUPPORTED_ENGINES;

// モーフィング可能なターゲット一覧を取得
watchEffect(() => {
if (
audioItem.value != undefined &&
audioItem.value.engineId != undefined &&
audioItem.value.styleId != undefined
) {
if (audioItem.value != undefined) {
store.dispatch("LOAD_MORPHABLE_TARGETS", {
engineId: audioItem.value.engineId,
baseStyleId: audioItem.value.styleId,
engineId: audioItem.value.voice.engineId,
baseStyleId: audioItem.value.voice.styleId,
});
}
});
Expand All @@ -669,11 +666,8 @@ const morphingTargetCharacters = computed<CharacterInfo[]>(() => {
if (allCharacterInfos == undefined)
throw new Error("USER_ORDERED_CHARACTER_INFOS == undefined");

const baseEngineId = audioItem.value.engineId;
const baseStyleId = audioItem.value.styleId;
if (baseEngineId === undefined || baseStyleId == undefined) {
throw new Error("baseEngineId == undefined || baseStyleId == undefined");
}
const baseEngineId = audioItem.value.voice.engineId;
const baseStyleId = audioItem.value.voice.styleId;

// モーフィング対象リストを問い合わせていないときはとりあえず空欄を表示
// FIXME: そもそもモーフィングUIを表示しないようにする
Expand Down
8 changes: 4 additions & 4 deletions src/components/CharacterPortrait.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export default defineComponent({
? store.state.audioItems[activeAudioKey]
: undefined;

const engineId = audioItem?.engineId;
const styleId = audioItem?.styleId;
const engineId = audioItem?.voice.engineId;
const styleId = audioItem?.voice.styleId;

if (
engineId === undefined ||
Expand All @@ -47,7 +47,7 @@ export default defineComponent({
? store.state.audioItems[activeAudioKey]
: undefined;

const styleId = audioItem?.styleId;
const styleId = audioItem?.voice.styleId;
const style = characterInfo.value?.metas.styles.find(
(style) => style.styleId === styleId
);
Expand All @@ -65,7 +65,7 @@ export default defineComponent({
const audioItem = activeAudioKey
? store.state.audioItems[activeAudioKey]
: undefined;
const engineId = audioItem?.engineId ?? store.state.engineIds[0];
const engineId = audioItem?.voice.engineId ?? store.state.engineIds[0];
const engineManifest = store.state.engineManifests[engineId];
const engineInfo = store.state.engineInfos[engineId];
return engineManifest ? engineManifest.brandName : engineInfo.name;
Expand Down
31 changes: 12 additions & 19 deletions src/components/DictionaryManageDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -360,16 +360,15 @@ const selectedId = ref("");
const surface = ref("");
const yomi = ref("");

const styleId = computed(() => {
if (!store.getters.USER_ORDERED_CHARACTER_INFOS) return 0;
return store.getters.USER_ORDERED_CHARACTER_INFOS[0].metas.styles[0].styleId;
});
const engineIdComputed = computed(() => {
const voiceComputed = computed(() => {
if (store.getters.USER_ORDERED_CHARACTER_INFOS == undefined)
throw new Error("assert USER_ORDERED_CHARACTER_INFOS");
if (store.state.engineIds.length === 0)
throw new Error("assert engineId.length > 0");
if (!store.getters.USER_ORDERED_CHARACTER_INFOS)
throw new Error("assert USER_ORDERED_CHARACTER_INFOS");
return store.getters.USER_ORDERED_CHARACTER_INFOS[0].metas.styles[0].engineId;
const characterInfo = store.getters.USER_ORDERED_CHARACTER_INFOS[0].metas;
const speakerId = characterInfo.speakerUuid;
const { engineId, styleId } = characterInfo.styles[0];
return { engineId, speakerId, styleId };
});

const kanaRegex = createKanaRegex();
Expand All @@ -393,8 +392,7 @@ const setSurface = (text: string) => {
surface.value = convertHankakuToZenkaku(text);
};
const setYomi = async (text: string, changeWord?: boolean) => {
const engineId = engineIdComputed.value;
if (engineId === undefined) throw new Error(`assert engineId !== undefined`);
const { engineId, styleId } = voiceComputed.value;

// テキスト長が0の時にエラー表示にならないように、テキスト長を考慮する
isOnlyHiraOrKana.value = !text.length || kanaRegex.test(text);
Expand All @@ -419,7 +417,7 @@ const setYomi = async (text: string, changeWord?: boolean) => {
store.dispatch("FETCH_ACCENT_PHRASES", {
text: text + "ガ'",
engineId,
styleId: styleId.value,
styleId,
isKana: true,
})
)
Expand All @@ -434,8 +432,7 @@ const setYomi = async (text: string, changeWord?: boolean) => {
};

const changeAccent = async (_: number, accent: number) => {
const engineId = engineIdComputed.value;
if (engineId === undefined) throw new Error(`assert engineId !== undefined`);
const { engineId, styleId } = voiceComputed.value;

if (accentPhrase.value) {
accentPhrase.value.accent = accent;
Expand All @@ -444,7 +441,7 @@ const changeAccent = async (_: number, accent: number) => {
store.dispatch("FETCH_MORA_DATA", {
accentPhrases: [accentPhrase.value],
engineId,
styleId: styleId.value,
styleId,
})
)
)[0];
Expand All @@ -455,16 +452,12 @@ const audioElem = new Audio();
audioElem.pause();

const play = async () => {
const engineId = engineIdComputed.value;
if (engineId === undefined) throw new Error(`assert engineId !== undefined`);

if (!accentPhrase.value) return;

nowGenerating.value = true;
const audioItem = await store.dispatch("GENERATE_AUDIO_ITEM", {
text: yomi.value,
engineId,
styleId: styleId.value,
voice: voiceComputed.value,
});

if (audioItem.query == undefined)
Expand Down
Loading