diff --git a/src/components/Dialog/PresetManageDialog.vue b/src/components/Dialog/PresetManageDialog.vue index 7b93606357..2aef0a4eb5 100644 --- a/src/components/Dialog/PresetManageDialog.vue +++ b/src/components/Dialog/PresetManageDialog.vue @@ -1,41 +1,141 @@ @@ -43,9 +143,15 @@ import { computed, ref } from "vue"; import Draggable from "vuedraggable"; import { useStore } from "@/store"; - +import BaseListItem from "@/components/Base/BaseListItem.vue"; +import BaseNavigationView from "@/components/Base/BaseNavigationView.vue"; +import BaseScrollArea from "@/components/Base/BaseScrollArea.vue"; +import BaseIconButton from "@/components/Base/BaseIconButton.vue"; +import BaseSlider from "@/components/Base/BaseSlider.vue"; +import CharacterButton from "@/components/CharacterButton.vue"; import { useDefaultPreset } from "@/composables/useDefaultPreset"; import { Preset, PresetKey } from "@/type/preload"; +import { SLIDER_PARAMETERS } from "@/store/utility"; const props = defineProps<{ openDialog: boolean; @@ -87,6 +193,71 @@ const previewPresetList = computed(() => : presetList.value, ); +const morphingTargetEngines = store.getters.MORPHING_SUPPORTED_ENGINES; + +const selectedPresetKey = ref(); +const selectedPreset = computed(() => { + return previewPresetList.value.find( + (preset) => preset.key === selectedPresetKey.value, + ); +}); + +const parameterConfigs = [ + { + label: "話速", + parameterKey: "speedScale", + sliderKey: "SPEED", + }, + { + label: "音高", + parameterKey: "pitchScale", + sliderKey: "PITCH", + }, + { + label: "抑揚", + parameterKey: "intonationScale", + sliderKey: "INTONATION", + }, + { + label: "音量", + parameterKey: "volumeScale", + sliderKey: "VOLUME", + }, + { + label: "開始無音", + parameterKey: "prePhonemeLength", + sliderKey: "PRE_PHONEME_LENGTH", + }, + { + label: "終了無音", + parameterKey: "postPhonemeLength", + sliderKey: "POST_PHONEME_LENGTH", + }, +]; + +const getParameterConfig = (sliderKey: string) => { + return parameterConfigs.find((config) => config.sliderKey === sliderKey); +}; + +const getParameterValue = (sliderKey: string) => { + if (!selectedPreset.value) { + return; + } + + const parameters = Object.entries(selectedPreset.value); + const parameter = parameters.find( + (preset) => preset[0] === getParameterConfig(sliderKey)?.parameterKey, + ); + + const parameterValue = Number(parameter?.[1]); + + if (Number.isNaN(parameterValue)) { + return; + } + + return parameterValue; +}; + const reorderPreset = (featurePresetList: (Preset & { key: PresetKey })[]) => { const newPresetKeys = featurePresetList.map((item) => item.key); previewPresetKeys.value = newPresetKeys; @@ -115,11 +286,101 @@ const deletePreset = async (key: PresetKey) => { }); } }; + +const morphingTargetCharacterInfo = computed(() => + store.getters + .USER_ORDERED_CHARACTER_INFOS("talk") + ?.find( + (character) => + character.metas.speakerUuid === + selectedPreset.value?.morphingInfo?.targetSpeakerId, + ), +); + +const morphingTargetStyleInfo = computed(() => { + const morphingInfo = selectedPreset.value?.morphingInfo; + + if (!morphingInfo) return; + + return morphingTargetCharacterInfo.value?.metas.styles.find( + (style) => + style.engineId === morphingInfo.targetEngineId && + style.styleId === morphingInfo.targetStyleId, + ); +});