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

スタイルの"ノーマル"を定数にする #1520

Merged
merged 1 commit into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion src/components/CharacterTryListenCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"
/>
<span aria-live="polite">{{
selectedStyle.styleName || "ノーマル"
selectedStyle.styleName || DEFAULT_STYLE_NAME
}}</span>
<q-btn
flat
Expand Down Expand Up @@ -95,6 +95,7 @@
<script setup lang="ts">
import { computed, ref } from "vue";
import { CharacterInfo, SpeakerId, StyleId, StyleInfo } from "@/type/preload";
import { DEFAULT_STYLE_NAME } from "@/store/utility";

const props =
defineProps<{
Expand Down
3 changes: 2 additions & 1 deletion src/components/DefaultStyleListDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
>{{
selectedStyles[speaker.metas.speakerUuid]
? selectedStyles[speaker.metas.speakerUuid].styleName
: "ノーマル"
: DEFAULT_STYLE_NAME
}}({{
characterInfosMap[speaker.metas.speakerUuid].metas
.styles.length
Expand All @@ -99,6 +99,7 @@
<script setup lang="ts">
import { computed, ref, watch } from "vue";
import { useStore } from "@/store";
import { DEFAULT_STYLE_NAME } from "@/store/utility";
import { CharacterInfo, SpeakerId, StyleInfo } from "@/type/preload";
import DefaultStyleSelectDialog from "@/components/DefaultStyleSelectDialog.vue";

Expand Down
3 changes: 2 additions & 1 deletion src/components/DefaultStyleSelectDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<div class="style-item-inner">
<img :src="style.iconPath" class="style-icon" />
<span class="text-subtitle1 q-ma-sm">{{
style.styleName || "ノーマル"
style.styleName || DEFAULT_STYLE_NAME
}}</span>
<div class="voice-samples">
<q-btn
Expand Down Expand Up @@ -123,6 +123,7 @@
<script setup lang="ts">
import { computed, ref, watch } from "vue";
import { useStore } from "@/store";
import { DEFAULT_STYLE_NAME } from "@/store/utility";
import {
CharacterInfo,
DefaultStyleId,
Expand Down
11 changes: 7 additions & 4 deletions src/store/audio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
extractExportText,
extractYomiText,
sanitizeFileName,
DEFAULT_STYLE_NAME,
} from "./utility";
import { convertAudioQueryFromEditorToEngine } from "./proxy";
import { createPartialStore } from "./vuex";
Expand Down Expand Up @@ -101,7 +102,9 @@ function parseTextFile(
for (const characterInfo of userOrderedCharacterInfos) {
for (const style of characterInfo.metas.styles) {
name2Voice.set(
`${characterInfo.metas.speakerName}(${style.styleName || "ノーマル"})`,
`${characterInfo.metas.speakerName}(${
style.styleName || DEFAULT_STYLE_NAME
})`,
{
engineId: style.engineId,
speakerId: characterInfo.metas.speakerUuid,
Expand Down Expand Up @@ -437,7 +440,7 @@ export const audioStore = createPartialStore<AudioStoreTypes>({
);
if (style === undefined) throw new Error("assert style !== undefined");

const styleName = style.styleName || "ノーマル";
const styleName = style.styleName || DEFAULT_STYLE_NAME;
return `${characterInfo.metas.speakerName}(${styleName})`;
},
},
Expand Down Expand Up @@ -1145,7 +1148,7 @@ export const audioStore = createPartialStore<AudioStoreTypes>({
);
if (style === undefined) throw new Error("assert style !== undefined");

const styleName = style.styleName || "ノーマル";
const styleName = style.styleName || DEFAULT_STYLE_NAME;
return buildAudioFileNameFromRawData(fileNamePattern, {
characterName: character.metas.speakerName,
index,
Expand Down Expand Up @@ -1668,7 +1671,7 @@ export const audioStore = createPartialStore<AudioStoreTypes>({
characters.set(
`${style.engineId}:${style.styleId}`, // FIXME: 入れ子のMapにする
`${characterInfo.metas.speakerName}(${
style.styleName || "ノーマル"
style.styleName || DEFAULT_STYLE_NAME
})`
);
}
Expand Down
4 changes: 3 additions & 1 deletion src/store/utility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { Platform } from "quasar";
import { ToolbarButtonTagType, isMac } from "@/type/preload";
import { AccentPhrase } from "@/openapi";

export const DEFAULT_STYLE_NAME = "ノーマル";

export function sanitizeFileName(fileName: string): string {
// \x00 - \x1f: ASCII 制御文字
// \x00: Null
Expand Down Expand Up @@ -43,7 +45,7 @@ const DEFAULT_AUDIO_FILE_NAME_VARIABLES = {
index: 0,
characterName: "四国めたん",
text: "テキストテキストテキスト",
styleName: "ノーマル",
styleName: DEFAULT_STYLE_NAME,
date: currentDateString(),
};

Expand Down