Skip to content

Commit

Permalink
微調整
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiroshiba committed Jun 30, 2024
1 parent 869a585 commit fda0dbc
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
9 changes: 5 additions & 4 deletions src/store/audio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
formatCharacterStyleName,
TuningTranscription,
filterCharacterInfosByStyleType,
DEFAULT_PROJECT_NAME,
} from "./utility";
import { createPartialStore } from "./vuex";
import { determineNextPresetKey } from "./preset";
Expand Down Expand Up @@ -1195,7 +1196,9 @@ export const audioStore = createPartialStore<AudioStoreTypes>({

const defaultFileBaseName = sanitizeFileName(headTailItemText);

return defaultFileBaseName === "" ? "Untitled" : defaultFileBaseName;
return defaultFileBaseName === ""
? DEFAULT_PROJECT_NAME
: defaultFileBaseName;
},
},

Expand All @@ -1220,9 +1223,7 @@ export const audioStore = createPartialStore<AudioStoreTypes>({
if (style == undefined) throw new Error("assert style != undefined");

const styleName = style.styleName || DEFAULT_STYLE_NAME;

const projectName = getters.PROJECT_NAME ?? "";

const projectName = getters.PROJECT_NAME ?? DEFAULT_PROJECT_NAME;
return buildAudioFileNameFromRawData(fileNamePattern, {
characterName: character.metas.speakerName,
index,
Expand Down
6 changes: 3 additions & 3 deletions src/store/singing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
SequencerEditTarget,
PhraseSourceHash,
} from "./type";
import { sanitizeFileName } from "./utility";
import { DEFAULT_PROJECT_NAME, sanitizeFileName } from "./utility";
import { EngineId, NoteId, StyleId } from "@/type/preload";
import { FrameAudioQuery, Note as NoteForRequestToEngine } from "@/openapi";
import { ResultError, getValueOrThrow } from "@/type/result";
Expand Down Expand Up @@ -1895,7 +1895,7 @@ export const singingStore = createPartialStore<SingingStoreTypes>({
const generateDefaultSongFileName = () => {
const projectName = getters.PROJECT_NAME;
if (projectName) {
return projectName.split(".")[0] + ".wav";
return projectName + ".wav";
}

const singer = getters.SELECTED_TRACK.singer;
Expand All @@ -1915,7 +1915,7 @@ export const singingStore = createPartialStore<SingingStoreTypes>({
}
}

return "Untitled.wav";
return `${DEFAULT_PROJECT_NAME}.wav`;
};

const exportWaveFile = async (): Promise<SaveResultObject> => {
Expand Down
3 changes: 2 additions & 1 deletion src/store/utility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
import { AccentPhrase, Mora } from "@/openapi";

export const DEFAULT_STYLE_NAME = "ノーマル";
export const DEFAULT_PROJECT_NAME = "Untitled";

export const formatCharacterStyleName = (
characterName: string,
Expand Down Expand Up @@ -120,7 +121,7 @@ export const replaceTagIdToTagString = {
styleName: "スタイル",
text: "テキスト",
date: "日付",
projectName: "プロジェクトファイル名",
projectName: "プロジェクト名",
};
const replaceTagStringToTagId: { [tagString: string]: string } = Object.entries(
replaceTagIdToTagString,
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/store/utility.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ describe("isAccentPhrasesTextDifferent", () => {

test("buildAudioFileNameFromRawData", () => {
const fileNamePattern =
"index=$連番$ characterName=$キャラ$ text=$テキスト$ styleName=$スタイル$ date=$日付$ projectName=$プロジェクトファイル名$";
"index=$連番$ characterName=$キャラ$ text=$テキスト$ styleName=$スタイル$ date=$日付$ projectName=$プロジェクト名$";
const vars = {
index: 10,
characterName: "キャラ1",
Expand Down

0 comments on commit fda0dbc

Please sign in to comment.