diff --git a/README.md b/README.md index 93aa208cf6..30518730d1 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ npm ci Windows の場合でもパスの区切り文字は`\`ではなく`/`なのでご注意ください。 -また、macOS 向けの`VOICEVOX.app`を利用している場合は`/path/to/VOICEVOX.app/Contents/MacOS/run`を指定してください。 +また、macOS 向けの`VOICEVOX.app`を利用している場合は`/path/to/VOICEVOX.app/Contents/MacOS/vv-engine/run`を指定してください。 Linux の場合は、[Releases](https://github.com/VOICEVOX/voicevox/releases/)から入手できる tar.gz 版に含まれる`run`コマンドを指定してください。 AppImage 版の場合は`$ /path/to/VOICEVOX.AppImage --appimage-mount`でファイルシステムをマウントできます。 diff --git a/src/store/audio.ts b/src/store/audio.ts index caa664fea2..79bc6cf240 100644 --- a/src/store/audio.ts +++ b/src/store/audio.ts @@ -23,6 +23,7 @@ import { formatCharacterStyleName, TuningTranscription, filterCharacterInfosByStyleType, + DEFAULT_PROJECT_NAME, } from "./utility"; import { createPartialStore } from "./vuex"; import { determineNextPresetKey } from "./preset"; @@ -1216,12 +1217,14 @@ export const audioStore = createPartialStore({ const defaultFileBaseName = sanitizeFileName(headTailItemText); - return defaultFileBaseName === "" ? "Untitled" : defaultFileBaseName; + return defaultFileBaseName === "" + ? DEFAULT_PROJECT_NAME + : defaultFileBaseName; }, }, DEFAULT_AUDIO_FILE_NAME: { - getter: (state) => (audioKey) => { + getter: (state, getters) => (audioKey) => { const fileNamePattern = state.savingSetting.fileNamePattern; const index = state.audioKeys.indexOf(audioKey); @@ -1241,12 +1244,14 @@ export const audioStore = createPartialStore({ if (style == undefined) throw new Error("assert style != undefined"); const styleName = style.styleName || DEFAULT_STYLE_NAME; + const projectName = getters.PROJECT_NAME ?? DEFAULT_PROJECT_NAME; return buildAudioFileNameFromRawData(fileNamePattern, { characterName: character.metas.speakerName, index, styleName, text: audioItem.text, date: currentDateString(), + projectName, }); }, }, diff --git a/src/store/project.ts b/src/store/project.ts index 64f14a2910..951b69dbd8 100755 --- a/src/store/project.ts +++ b/src/store/project.ts @@ -73,7 +73,7 @@ const applySongProjectToStore = async ( }; export const projectStore = createPartialStore({ - PROJECT_NAME: { + PROJECT_NAME_WITH_EXT: { getter(state) { return state.projectFilePath ? getBaseName(state.projectFilePath) @@ -81,6 +81,14 @@ export const projectStore = createPartialStore({ }, }, + PROJECT_NAME: { + getter(state) { + return state.projectFilePath + ? getBaseName(state.projectFilePath).replace(".vvproj", "") + : undefined; + }, + }, + SET_PROJECT_FILEPATH: { mutation(state, { filePath }: { filePath?: string }) { state.projectFilePath = filePath; diff --git a/src/store/singing.ts b/src/store/singing.ts index d21441642d..d08ae47906 100644 --- a/src/store/singing.ts +++ b/src/store/singing.ts @@ -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"; @@ -1895,7 +1895,7 @@ export const singingStore = createPartialStore({ const generateDefaultSongFileName = () => { const projectName = getters.PROJECT_NAME; if (projectName) { - return projectName.split(".")[0] + ".wav"; + return projectName + ".wav"; } const singer = getters.SELECTED_TRACK.singer; @@ -1915,7 +1915,7 @@ export const singingStore = createPartialStore({ } } - return "Untitled.wav"; + return `${DEFAULT_PROJECT_NAME}.wav`; }; const exportWaveFile = async (): Promise => { diff --git a/src/store/type.ts b/src/store/type.ts index c2be3e9dff..b94864d7aa 100644 --- a/src/store/type.ts +++ b/src/store/type.ts @@ -1473,6 +1473,10 @@ export type ProjectStoreState = { }; export type ProjectStoreTypes = { + PROJECT_NAME_WITH_EXT: { + getter: string | undefined; + }; + PROJECT_NAME: { getter: string | undefined; }; diff --git a/src/store/utility.ts b/src/store/utility.ts index aaf222f50e..9a794b7405 100644 --- a/src/store/utility.ts +++ b/src/store/utility.ts @@ -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, @@ -120,6 +121,7 @@ export const replaceTagIdToTagString = { styleName: "スタイル", text: "テキスト", date: "日付", + projectName: "プロジェクト名", }; const replaceTagStringToTagId: { [tagString: string]: string } = Object.entries( replaceTagIdToTagString, @@ -134,6 +136,7 @@ const DEFAULT_AUDIO_FILE_NAME_VARIABLES = { text: "テキストテキストテキスト", styleName: DEFAULT_STYLE_NAME, date: currentDateString(), + projectName: "VOICEVOXプロジェクト", }; export function currentDateString(): string { @@ -342,12 +345,14 @@ export function buildAudioFileNameFromRawData( const index = (vars.index + 1).toString().padStart(3, "0"); const styleName = sanitizeFileName(vars.styleName); const date = vars.date; + const projectName = sanitizeFileName(vars.projectName); return replaceTag(pattern, { text, characterName, index, styleName, date, + projectName, }); } diff --git a/tests/unit/store/utility.spec.ts b/tests/unit/store/utility.spec.ts index dff4ae2120..c4a8907dc9 100644 --- a/tests/unit/store/utility.spec.ts +++ b/tests/unit/store/utility.spec.ts @@ -251,17 +251,18 @@ describe("isAccentPhrasesTextDifferent", () => { test("buildAudioFileNameFromRawData", () => { const fileNamePattern = - "index=$連番$ characterName=$キャラ$ text=$テキスト$ styleName=$スタイル$ date=$日付$"; + "index=$連番$ characterName=$キャラ$ text=$テキスト$ styleName=$スタイル$ date=$日付$ projectName=$プロジェクト名$"; const vars = { index: 10, characterName: "キャラ1", text: "テストテキスト", styleName: "スタイル1", date: "20210801", + projectName: "サンプルプロジェクト", }; const result = buildAudioFileNameFromRawData(fileNamePattern, vars); expect(result).toBe( - "index=011 characterName=キャラ1 text=テストテキスト styleName=スタイル1 date=20210801", + "index=011 characterName=キャラ1 text=テストテキスト styleName=スタイル1 date=20210801 projectName=サンプルプロジェクト", ); });