Skip to content

Commit

Permalink
Merge remote-tracking branch 'takusea/redesign-preset-manage-dialog' …
Browse files Browse the repository at this point in the history
…into hiho-counter-pr-73501e1a
  • Loading branch information
Hiroshiba committed Dec 21, 2024
2 parents 73501e1 + 01822f2 commit 6997174
Show file tree
Hide file tree
Showing 47 changed files with 2,316 additions and 281 deletions.
28 changes: 26 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"glob": "11.0.0",
"hotkeys-js": "3.13.6",
"immer": "9.0.21",
"kuromoji": "github:VOICEVOX/kuromoji.js#0.0.1",
"markdown-it": "13.0.2",
"move-file": "3.0.0",
"multistream": "4.1.0",
Expand Down
2 changes: 1 addition & 1 deletion src/backend/browser/sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import {
EngineId,
EngineSettingType,
EngineSettings,
HotkeySettingType,
Sandbox,
} from "@/type/preload";
import { AssetTextFileNames } from "@/type/staticResources";
import { HotkeySettingType } from "@/domain/hotkeyAction";

const toStaticPath = (fileName: string) =>
`${import.meta.env.BASE_URL}/${fileName}`.replaceAll(/\/\/+/g, "/");
Expand Down
14 changes: 11 additions & 3 deletions src/backend/common/ConfigManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ import {
ConfigType,
configSchema,
DefaultStyleId,
defaultHotkeySettings,
HotkeySettingType,
ExperimentalSettingType,
HotkeyCombination,
VoiceId,
PresetKey,
} from "@/type/preload";
import { ensureNotNullish } from "@/helpers/errorHelper";
import { loadEnvEngineInfos } from "@/domain/defaultEngine/envEngineInfo";
import {
HotkeyCombination,
defaultHotkeySettings,
HotkeySettingType,
} from "@/domain/hotkeyAction";

const lockKey = "save";

Expand Down Expand Up @@ -341,6 +343,12 @@ export abstract class BaseConfigManager {
this._save();
}

/** 全ての設定を取得する。テスト用。 */
public getAll(): ConfigType {
if (!this.config) throw new Error("Config is not initialized");
return this.config;
}

private _save() {
void this.lock.acquire(lockKey, async () => {
await this.save({
Expand Down
7 changes: 6 additions & 1 deletion src/components/Base/BaseSlider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
:disabled
:modelValue="[model]"
@update:modelValue="
(value) => value != undefined && $emit('update:modelValue', value[0])
(value) => {
if (value == undefined) {
throw new Error('Undefined value received');
}
$emit('update:modelValue', value[0]);
}
"
>
<SliderTrack class="SliderTrack">
Expand Down
2 changes: 1 addition & 1 deletion src/components/Dialog/HotkeyRecordingDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@

<script setup lang="ts">
import { computed } from "vue";
import { HotkeyCombination } from "@/type/preload";
import { HotkeyCombination } from "@/domain/hotkeyAction";
const props = defineProps<{
isHotkeyDialogOpened: boolean;
Expand Down
8 changes: 4 additions & 4 deletions src/components/Dialog/HotkeySettingDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@ import BaseButton from "@/components/Base/BaseButton.vue";
import BaseIconButton from "@/components/Base/BaseIconButton.vue";
import BaseScrollArea from "@/components/Base/BaseScrollArea.vue";
import { useStore } from "@/store";
import { useHotkeyManager, eventToCombination } from "@/plugins/hotkeyPlugin";
import {
defaultHotkeySettings,
HotkeyActionNameType,
HotkeyCombination,
} from "@/type/preload";
import { useHotkeyManager, eventToCombination } from "@/plugins/hotkeyPlugin";
HotkeyActionNameType,
defaultHotkeySettings,
} from "@/domain/hotkeyAction";
const props = defineProps<{
modelValue: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Menu/MenuItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
import { ref, computed, watch } from "vue";
import { MenuItemData } from "./type";
import { useStore } from "@/store";
import { hotkeyActionNameSchema } from "@/type/preload";
import { hotkeyActionNameSchema } from "@/domain/hotkeyAction";
const props = withDefaults(
defineProps<{
selected?: boolean;
Expand Down
85 changes: 42 additions & 43 deletions src/components/Talk/AudioInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ import {
MorphingInfo,
Preset,
PresetKey,
PresetSliderKey,
Voice,
} from "@/type/preload";
import {
Expand Down Expand Up @@ -348,14 +349,12 @@ const selectedAudioKeys = computed(() =>
: [props.activeAudioKey],
);
type ParameterKey = keyof Omit<Preset, "name" | "morphingInfo">; // NOTE: パラメーターの種類はPresetのキーと同じ
/** パラメーターを制御するための元情報リスト */
type ParameterConfig = {
label: string;
sliderProps: Omit<PreviewSliderHelperProps, "onChange">;
onChange: PreviewSliderHelperProps["onChange"]; // NOTE: onChangeだけ使い回すので分離している
key: ParameterKey;
key: PresetSliderKey;
};
const parameterConfigs = computed<ParameterConfig[]>(() => [
{
Expand All @@ -364,11 +363,11 @@ const parameterConfigs = computed<ParameterConfig[]>(() => [
modelValue: () => query.value?.speedScale ?? null,
disable: () =>
uiLocked.value || !supportedFeatures.value?.adjustSpeedScale,
max: SLIDER_PARAMETERS.SPEED.max,
min: SLIDER_PARAMETERS.SPEED.min,
step: SLIDER_PARAMETERS.SPEED.step,
scrollStep: SLIDER_PARAMETERS.SPEED.scrollStep,
scrollMinStep: SLIDER_PARAMETERS.SPEED.scrollMinStep,
max: SLIDER_PARAMETERS.speedScale.max,
min: SLIDER_PARAMETERS.speedScale.min,
step: SLIDER_PARAMETERS.speedScale.step,
scrollStep: SLIDER_PARAMETERS.speedScale.scrollStep,
scrollMinStep: SLIDER_PARAMETERS.speedScale.scrollMinStep,
},
onChange: (speedScale: number) =>
store.actions.COMMAND_MULTI_SET_AUDIO_SPEED_SCALE({
Expand All @@ -383,10 +382,10 @@ const parameterConfigs = computed<ParameterConfig[]>(() => [
modelValue: () => query.value?.pitchScale ?? null,
disable: () =>
uiLocked.value || !supportedFeatures.value?.adjustPitchScale,
max: SLIDER_PARAMETERS.PITCH.max,
min: SLIDER_PARAMETERS.PITCH.min,
step: SLIDER_PARAMETERS.PITCH.step,
scrollStep: SLIDER_PARAMETERS.PITCH.scrollStep,
max: SLIDER_PARAMETERS.pitchScale.max,
min: SLIDER_PARAMETERS.pitchScale.min,
step: SLIDER_PARAMETERS.pitchScale.step,
scrollStep: SLIDER_PARAMETERS.pitchScale.scrollStep,
},
onChange: (pitchScale: number) =>
store.actions.COMMAND_MULTI_SET_AUDIO_PITCH_SCALE({
Expand All @@ -401,11 +400,11 @@ const parameterConfigs = computed<ParameterConfig[]>(() => [
modelValue: () => query.value?.intonationScale ?? null,
disable: () =>
uiLocked.value || !supportedFeatures.value?.adjustIntonationScale,
max: SLIDER_PARAMETERS.INTONATION.max,
min: SLIDER_PARAMETERS.INTONATION.min,
step: SLIDER_PARAMETERS.INTONATION.step,
scrollStep: SLIDER_PARAMETERS.INTONATION.scrollStep,
scrollMinStep: SLIDER_PARAMETERS.INTONATION.scrollMinStep,
max: SLIDER_PARAMETERS.intonationScale.max,
min: SLIDER_PARAMETERS.intonationScale.min,
step: SLIDER_PARAMETERS.intonationScale.step,
scrollStep: SLIDER_PARAMETERS.intonationScale.scrollStep,
scrollMinStep: SLIDER_PARAMETERS.intonationScale.scrollMinStep,
},
onChange: (intonationScale: number) =>
store.actions.COMMAND_MULTI_SET_AUDIO_INTONATION_SCALE({
Expand All @@ -420,11 +419,11 @@ const parameterConfigs = computed<ParameterConfig[]>(() => [
modelValue: () => query.value?.volumeScale ?? null,
disable: () =>
uiLocked.value || !supportedFeatures.value?.adjustVolumeScale,
max: SLIDER_PARAMETERS.VOLUME.max,
min: SLIDER_PARAMETERS.VOLUME.min,
step: SLIDER_PARAMETERS.VOLUME.step,
scrollStep: SLIDER_PARAMETERS.VOLUME.scrollStep,
scrollMinStep: SLIDER_PARAMETERS.VOLUME.scrollMinStep,
max: SLIDER_PARAMETERS.volumeScale.max,
min: SLIDER_PARAMETERS.volumeScale.min,
step: SLIDER_PARAMETERS.volumeScale.step,
scrollStep: SLIDER_PARAMETERS.volumeScale.scrollStep,
scrollMinStep: SLIDER_PARAMETERS.volumeScale.scrollMinStep,
},
onChange: (volumeScale: number) =>
store.actions.COMMAND_MULTI_SET_AUDIO_VOLUME_SCALE({
Expand All @@ -439,11 +438,11 @@ const parameterConfigs = computed<ParameterConfig[]>(() => [
modelValue: () => query.value?.pauseLengthScale ?? null,
disable: () =>
uiLocked.value || !supportedFeatures.value?.adjustPauseLength,
max: SLIDER_PARAMETERS.PAUSE_LENGTH_SCALE.max,
min: SLIDER_PARAMETERS.PAUSE_LENGTH_SCALE.min,
step: SLIDER_PARAMETERS.PAUSE_LENGTH_SCALE.step,
scrollStep: SLIDER_PARAMETERS.PAUSE_LENGTH_SCALE.scrollStep,
scrollMinStep: SLIDER_PARAMETERS.PAUSE_LENGTH_SCALE.scrollMinStep,
max: SLIDER_PARAMETERS.pauseLengthScale.max,
min: SLIDER_PARAMETERS.pauseLengthScale.min,
step: SLIDER_PARAMETERS.pauseLengthScale.step,
scrollStep: SLIDER_PARAMETERS.pauseLengthScale.scrollStep,
scrollMinStep: SLIDER_PARAMETERS.pauseLengthScale.scrollMinStep,
},
onChange: (pauseLengthScale: number) =>
store.actions.COMMAND_MULTI_SET_AUDIO_PAUSE_LENGTH_SCALE({
Expand All @@ -457,11 +456,11 @@ const parameterConfigs = computed<ParameterConfig[]>(() => [
sliderProps: {
modelValue: () => query.value?.prePhonemeLength ?? null,
disable: () => uiLocked.value,
max: SLIDER_PARAMETERS.PRE_PHONEME_LENGTH.max,
min: SLIDER_PARAMETERS.PRE_PHONEME_LENGTH.min,
step: SLIDER_PARAMETERS.PRE_PHONEME_LENGTH.step,
scrollStep: SLIDER_PARAMETERS.PRE_PHONEME_LENGTH.scrollStep,
scrollMinStep: SLIDER_PARAMETERS.PRE_PHONEME_LENGTH.scrollMinStep,
max: SLIDER_PARAMETERS.prePhonemeLength.max,
min: SLIDER_PARAMETERS.prePhonemeLength.min,
step: SLIDER_PARAMETERS.prePhonemeLength.step,
scrollStep: SLIDER_PARAMETERS.prePhonemeLength.scrollStep,
scrollMinStep: SLIDER_PARAMETERS.prePhonemeLength.scrollMinStep,
},
onChange: (prePhonemeLength: number) =>
store.actions.COMMAND_MULTI_SET_AUDIO_PRE_PHONEME_LENGTH({
Expand All @@ -475,11 +474,11 @@ const parameterConfigs = computed<ParameterConfig[]>(() => [
sliderProps: {
modelValue: () => query.value?.postPhonemeLength ?? null,
disable: () => uiLocked.value,
max: SLIDER_PARAMETERS.POST_PHONEME_LENGTH.max,
min: SLIDER_PARAMETERS.POST_PHONEME_LENGTH.min,
step: SLIDER_PARAMETERS.POST_PHONEME_LENGTH.step,
scrollStep: SLIDER_PARAMETERS.POST_PHONEME_LENGTH.scrollStep,
scrollMinStep: SLIDER_PARAMETERS.POST_PHONEME_LENGTH.scrollMinStep,
max: SLIDER_PARAMETERS.postPhonemeLength.max,
min: SLIDER_PARAMETERS.postPhonemeLength.min,
step: SLIDER_PARAMETERS.postPhonemeLength.step,
scrollStep: SLIDER_PARAMETERS.postPhonemeLength.scrollStep,
scrollMinStep: SLIDER_PARAMETERS.postPhonemeLength.scrollMinStep,
},
onChange: (postPhonemeLength: number) =>
store.actions.COMMAND_MULTI_SET_AUDIO_POST_PHONEME_LENGTH({
Expand All @@ -495,7 +494,7 @@ type Parameter = {
label: string;
slider: PreviewSliderHelper;
onChange: PreviewSliderHelperProps["onChange"];
key: ParameterKey;
key: PresetSliderKey;
};
const parameters = computed<Parameter[]>(() =>
parameterConfigs.value.map((parameterConfig) => ({
Expand Down Expand Up @@ -665,11 +664,11 @@ const morphingRateSlider = previewSliderHelper({
modelValue: () => audioItem.value.morphingInfo?.rate ?? null,
disable: () => uiLocked.value,
onChange: setMorphingRate,
max: SLIDER_PARAMETERS.MORPHING_RATE.max,
min: SLIDER_PARAMETERS.MORPHING_RATE.min,
step: SLIDER_PARAMETERS.MORPHING_RATE.step,
scrollStep: SLIDER_PARAMETERS.MORPHING_RATE.scrollStep,
scrollMinStep: SLIDER_PARAMETERS.MORPHING_RATE.scrollMinStep,
max: SLIDER_PARAMETERS.morphingRate.max,
min: SLIDER_PARAMETERS.morphingRate.min,
step: SLIDER_PARAMETERS.morphingRate.step,
scrollStep: SLIDER_PARAMETERS.morphingRate.scrollStep,
scrollMinStep: SLIDER_PARAMETERS.morphingRate.scrollMinStep,
});
// プリセット
Expand Down
6 changes: 4 additions & 2 deletions src/components/Talk/TalkEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,14 @@ import {
PresetKey,
SplitterPositionType,
Voice,
HotkeyActionNameType,
actionPostfixSelectNthCharacter,
} from "@/type/preload";
import { useHotkeyManager } from "@/plugins/hotkeyPlugin";
import onetimeWatch from "@/helpers/onetimeWatch";
import path from "@/helpers/path";
import {
actionPostfixSelectNthCharacter,
HotkeyActionNameType,
} from "@/domain/hotkeyAction";
const props = defineProps<{
isEnginesReady: boolean;
Expand Down
Loading

0 comments on commit 6997174

Please sign in to comment.