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

Add: トラック毎の書き出しを追加 #2228

Merged
merged 44 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
671f52c
Add: トラック毎書き出しを追加
sevenc-nanashi Aug 18, 2024
d93e31b
Add: ファイル名設定を追加
sevenc-nanashi Aug 18, 2024
e4b4a3f
Add: パラメータ適用の切り換えを追加
sevenc-nanashi Aug 18, 2024
ffa5035
Delete: パラメータ書き出し周りを削除
sevenc-nanashi Aug 24, 2024
74a34dd
Change: デフォルトの書き出しファイル名にキャラ名を追加
sevenc-nanashi Aug 26, 2024
456fa43
Code: applyTrackParameters -> shouldApplyTrackParameters
sevenc-nanashi Aug 26, 2024
7a6d6c6
Change: DialogCell -> DialogButtonCell
sevenc-nanashi Aug 26, 2024
ed17385
Change: throwする
sevenc-nanashi Aug 26, 2024
f41ac76
Code: スタイル修正
sevenc-nanashi Aug 26, 2024
9166ab7
Code: buildFileName -> fileNameBuilder
sevenc-nanashi Aug 26, 2024
ab3e0ec
Refactor: 共通化
sevenc-nanashi Aug 26, 2024
02e619f
Change: DialogButtonCell -> EditButtonCell
sevenc-nanashi Sep 2, 2024
fdff200
Change: propsを変える
sevenc-nanashi Sep 2, 2024
eac3d15
Code: 定義を移動
sevenc-nanashi Sep 2, 2024
9d7e724
Change: click -> buttonClick
sevenc-nanashi Sep 3, 2024
e1c5ac6
Change: ファイル名のフォーマットあたりを変える
sevenc-nanashi Sep 3, 2024
06efbf4
Merge: upstream/main -> add/stem-export
sevenc-nanashi Sep 4, 2024
d426919
Fix: 上流からのマージのエラーを修正
sevenc-nanashi Sep 4, 2024
5af928d
Refactor: 変数名を整理
sevenc-nanashi Sep 4, 2024
6864b52
Change: FileNamePatternDialog -> FileNameTemplateDialog
sevenc-nanashi Sep 4, 2024
9a0e858
Refactor: props周りを整理
sevenc-nanashi Sep 5, 2024
5324496
Fix: 初期値が反映されないのを修正
sevenc-nanashi Sep 5, 2024
30616e7
Fix: value忘れ
sevenc-nanashi Sep 6, 2024
3b336e6
Add: storyを追加
sevenc-nanashi Sep 6, 2024
e9f2b7c
Code: コメントを追加
sevenc-nanashi Sep 6, 2024
2cb5f55
Update: test-runnerを更新してみる
sevenc-nanashi Sep 6, 2024
0c64861
Add: patchを追加
sevenc-nanashi Sep 7, 2024
d1599af
Fix: fnを消す
sevenc-nanashi Sep 7, 2024
153a0c3
Delete: patchを消す
sevenc-nanashi Sep 7, 2024
a9c8729
Revert: patchを戻す
sevenc-nanashi Sep 7, 2024
145835a
Delete: fnを消す
sevenc-nanashi Sep 7, 2024
c340ba8
Fix: patchしてない範囲があったので修正
sevenc-nanashi Sep 8, 2024
ee1f05f
Add: コメントを追加
sevenc-nanashi Sep 8, 2024
456d1d8
Delete: 不要な分岐を削除
sevenc-nanashi Sep 8, 2024
f91ab93
Code: patchのコメントを足す
sevenc-nanashi Sep 9, 2024
b1b3055
Change: findByTextにしてみる
sevenc-nanashi Sep 9, 2024
e2cde6d
Change: patch-packageを明示的に実行しないようにする
sevenc-nanashi Sep 9, 2024
532e2f2
Refactor: clearAndInputに共通化
sevenc-nanashi Sep 9, 2024
9dcc8f8
Fix: awaitする
sevenc-nanashi Sep 9, 2024
423e4c3
Change: toBeInTheDocumentにする
sevenc-nanashi Sep 9, 2024
b610fe4
Fix: やっぱりpatch-packageする
sevenc-nanashi Sep 9, 2024
a8956a2
Change: patchesを移動
sevenc-nanashi Sep 10, 2024
6754aac
Code: コメントを追加
sevenc-nanashi Sep 10, 2024
dd7fae6
Apply suggestions from code review
Hiroshiba Sep 10, 2024
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
2 changes: 1 addition & 1 deletion src/components/Dialog/HotkeyRecordingDialog.vue
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

トラックごとの書き出し機能、人によっては何度も何度も実行すると思うので、ショートカットキー実装しちゃうのどうでしょう?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ソングとトークで同じショートカットキーを設定出来ないっぽいので、それの修正と一緒に別PRでやろうとおもいます。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

うおーたすかります!!

Copy link
Member

@Hiroshiba Hiroshiba Aug 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

何度も修正&書き出しする場合、たぶん「書き出し先を固定する」とかなり相性が良さそうなのですが、どうでしょう・・・?

ソング側でショートカットキーで書き出し
→ DAW側で勝手に再読込される(されるんだろうか)
→ 聞く
→ ソング側で微調整
→ 以下繰り返し

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

実際あったら嬉しいですね。
#1250
これと一緒に実装…?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

組み合わせ良さそうですね!!
そのissueはUI/UXが自明じゃないので、少なくともこのPR内でのついでに実装はレビューが厳しくなる予感があります。
とりあえずそちらのissueについては、まずはissue内でUI/UXの検討を進めるとかどうでしょ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ですね。

Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
</template>

<script setup lang="ts">
import { computed, defineProps, defineEmits } from "vue";
import { computed } from "vue";
Hiroshiba marked this conversation as resolved.
Show resolved Hide resolved
import { HotkeyCombination } from "@/type/preload";

const props = defineProps<{
Expand Down
33 changes: 33 additions & 0 deletions src/components/Dialog/SettingDialog/DialogCell.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!-- 編集ダイアログが開く設定項目 -->
Hiroshiba marked this conversation as resolved.
Show resolved Hide resolved

<template>
<BaseCell :title :description>
<div class="q-px-sm text-ellipsis">
{{ props.currentValue }}
</div>
<QBtn
:label="props.label || '編集する'"
unelevated
color="background"
textColor="display"
class="text-no-wrap q-mr-sm"
@click="emit('click')"
/>
</BaseCell>
</template>

<script setup lang="ts">
import BaseCell, { Props as BaseCellProps } from "./BaseCell.vue";

const props = defineProps<
BaseCellProps & {
currentValue: string;
label?: string;
disable?: boolean;
}
>();

const emit = defineEmits<{
click: [];
}>();
</script>
45 changes: 22 additions & 23 deletions src/components/Dialog/SettingDialog/FileNamePatternDialog.vue
Hiroshiba marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<QCardSection>
<div class="text-h5">書き出しファイル名パターン</div>
<div class="text-body2 text-grey-8">
「$キャラ$」のようなタグを使って書き出すファイル名をカスタマイズできます
「$キャラ$」のようなタグを使って書き出すファイル名をカスタマイズできます
</div>
</QCardSection>
<QCardActions class="setting-card q-px-md q-py-sm">
Expand Down Expand Up @@ -39,7 +39,7 @@
</div>
</div>
<div class="text-body2 text-ellipsis">
出力例{{ previewFileName }}
出力例{{ previewFileName }}
</div>
<div class="row full-width q-my-md">
<QBtn
Expand Down Expand Up @@ -78,16 +78,13 @@
<script setup lang="ts">
import { computed, ref, nextTick } from "vue";
import { QInput } from "quasar";
import { useStore } from "@/store";
import {
buildAudioFileNameFromRawData,
DEFAULT_AUDIO_FILE_BASE_NAME_TEMPLATE,
replaceTagIdToTagString,
sanitizeFileName,
} from "@/store/utility";
import { replaceTagIdToTagString, sanitizeFileName } from "@/store/utility";

const props = defineProps<{
openDialog: boolean;
defaultTemplate: string;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(ただのコメントです)

こーーーーーーーこもちょっとややこしいかもですね。。
たぶんTempalteって書いてるけど、baseNamePatternのことな気がしますね。。

とはいえここの名称は元からそうなっていた(Templateだった)ので、このプルリクエストでの内容ではないですね。
もし気が向いたらついでにファクタリングしていただけると助かるかもです・・・!!

availableTags: (keyof typeof replaceTagIdToTagString)[];
buildFileName: (pattern: string) => string;
}>();

const emit = defineEmits<{
Expand All @@ -96,15 +93,18 @@ const emit = defineEmits<{

const updateOpenDialog = (isOpen: boolean) => emit("update:openDialog", isOpen);

const store = useStore();
const fileNamePattern = defineModel<string>("fileNamePattern", {
sevenc-nanashi marked this conversation as resolved.
Show resolved Hide resolved
type: String,
default: "",
});
const patternInput = ref<QInput>();
const maxLength = 128;
const tagStrings = Object.values(replaceTagIdToTagString);

const savingSetting = computed(() => store.state.savingSetting);
const tagStrings = computed(() =>
props.availableTags.map((tag) => replaceTagIdToTagString[tag]),
);

const savedBaseNamePattern = computed(() => {
return savingSetting.value.fileNamePattern.replace(/\.wav$/, "");
return fileNamePattern.value.replace(/\.wav$/, "");
});
const currentBaseNamePattern = ref(savedBaseNamePattern.value);
const currentNamePattern = computed(
Expand Down Expand Up @@ -140,18 +140,18 @@ const errorMessage = computed(() => {
const hasError = computed(() => errorMessage.value !== "");

const previewFileName = computed(() =>
buildAudioFileNameFromRawData(currentNamePattern.value),
props.buildFileName(currentNamePattern.value),
);

const initializeInput = () => {
currentBaseNamePattern.value = savedBaseNamePattern.value;

if (currentBaseNamePattern.value === "") {
currentBaseNamePattern.value = DEFAULT_AUDIO_FILE_BASE_NAME_TEMPLATE;
currentBaseNamePattern.value = props.defaultTemplate;
}
};
const resetToDefault = () => {
currentBaseNamePattern.value = DEFAULT_AUDIO_FILE_BASE_NAME_TEMPLATE;
currentBaseNamePattern.value = props.defaultTemplate;
patternInput.value?.focus();
};

Expand Down Expand Up @@ -179,12 +179,11 @@ const insertTagToCurrentPosition = (tag: string) => {
};

const submit = async () => {
await store.dispatch("SET_SAVING_SETTING", {
data: {
...savingSetting.value,
fileNamePattern: currentNamePattern.value,
},
});
if (hasError.value) {
return;
sevenc-nanashi marked this conversation as resolved.
Show resolved Hide resolved
}

fileNamePattern.value = currentNamePattern.value;
updateOpenDialog(false);
};
</script>
Expand Down
105 changes: 73 additions & 32 deletions src/components/Dialog/SettingDialog/SettingDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -298,39 +298,44 @@
</QCardActions>

<FileNamePatternDialog
v-model:open-dialog="showsFilePatternEditDialog"
v-model:open-dialog="showAudioFilePatternEditDialog"
v-model:fileNamePattern="audioFileNamePattern"
:defaultTemplate="DEFAULT_AUDIO_FILE_BASE_NAME_TEMPLATE"
:availableTags="[
'index',
'characterName',
'styleName',
'text',
'date',
'projectName',
]"
:buildFileName="buildAudioFileNameFromRawData"
sevenc-nanashi marked this conversation as resolved.
Show resolved Hide resolved
@complete="handleSavingSettingChange('fileNamePattern', $event)"
/>
<FileNamePatternDialog
v-model:open-dialog="showSongTrackAudioFilePatternEditDialog"
v-model:fileNamePattern="songTrackFileNamePattern"
:defaultTemplate="DEFAULT_SONG_AUDIO_FILE_BASE_NAME_TEMPLATE"
:availableTags="[
'index',
'characterName',
'styleName',
'trackName',
'date',
'projectName',
]"
:buildFileName="buildSongTrackAudioFileNameFromRawData"
@complete="
handleSavingSettingChange('songTrackFileNamePattern', $event)
"
/>

<QCardActions class="q-px-md bg-surface">
<div>書き出しファイル名パターン</div>
<div
aria-label="書き出す際のファイル名のパターンをカスタマイズできます。"
>
<QIcon name="help_outline" size="sm" class="help-hover-icon">
<QTooltip
:delay="500"
anchor="center right"
self="center left"
transitionShow="jump-right"
transitionHide="jump-left"
>
書き出す際のファイル名のパターンをカスタマイズできます。
</QTooltip>
</QIcon>
</div>
<QSpace />
<div class="q-px-sm text-ellipsis">
{{ savingSetting.fileNamePattern }}
</div>
<QBtn
label="編集する"
unelevated
color="background"
textColor="display"
class="text-no-wrap q-mr-sm"
@click="showsFilePatternEditDialog = true"
/>
</QCardActions>
<DialogCell
title="書き出しファイル名パターン"
description="書き出す際のファイル名のパターンをカスタマイズできます。"
:currentValue="savingSetting.fileNamePattern"
@click="showAudioFilePatternEditDialog = true"
/>

<ToggleCell
title="上書き防止"
Expand Down Expand Up @@ -368,6 +373,18 @@
handleSavingSettingChange('exportLab', $event)
"
/>

<QSlideTransition>
<!-- q-slide-transitionはheightだけをアニメーションするのでdivで囲う -->
<div v-show="experimentalSetting.enableMultiTrack">
<DialogCell
title="ソング:トラックファイル名パターン"
description="書き出す際のファイル名のパターンをカスタマイズできます。"
:currentValue="savingSetting.songTrackFileNamePattern"
@click="showSongTrackAudioFilePatternEditDialog = true"
sevenc-nanashi marked this conversation as resolved.
Show resolved Hide resolved
/>
</div>
</QSlideTransition>
</QCard>
<!-- Theme Card -->
<QCard flat class="setting-card">
Expand Down Expand Up @@ -554,7 +571,14 @@ import FileNamePatternDialog from "./FileNamePatternDialog.vue";
import ToggleCell from "./ToggleCell.vue";
import ButtonToggleCell from "./ButtonToggleCell.vue";
import BaseCell from "./BaseCell.vue";
import DialogCell from "./DialogCell.vue";
import { useStore } from "@/store";
import {
DEFAULT_AUDIO_FILE_BASE_NAME_TEMPLATE,
DEFAULT_SONG_AUDIO_FILE_BASE_NAME_TEMPLATE,
buildAudioFileNameFromRawData,
buildSongTrackAudioFileNameFromRawData,
} from "@/store/utility";
import {
isProduction,
SavingSetting,
Expand Down Expand Up @@ -801,6 +825,22 @@ const engineUseGpuOptions = [
{ label: "GPU", value: true },
];

const audioFileNamePattern = computed({
get: () => store.state.savingSetting.fileNamePattern,
set: (fileNamePattern: string) => {
handleSavingSettingChange("fileNamePattern", fileNamePattern);
},
});
const songTrackFileNamePattern = computed({
get: () => store.state.savingSetting.songTrackFileNamePattern,
set: (songTrackFileNamePattern: string) => {
handleSavingSettingChange(
"songTrackFileNamePattern",
songTrackFileNamePattern,
);
},
});

const gpuSwitchEnabled = (engineId: EngineId) => {
// CPU版でもGPUモードからCPUモードに変更できるようにする
return store.getters.ENGINE_CAN_USE_GPU(engineId) || engineUseGpu.value;
Expand Down Expand Up @@ -893,7 +933,8 @@ watchEffect(async () => {
const [splitTextWhenPaste, changeSplitTextWhenPaste] =
useRootMiscSetting("splitTextWhenPaste");

const showsFilePatternEditDialog = ref(false);
const showAudioFilePatternEditDialog = ref(false);
const showSongTrackAudioFilePatternEditDialog = ref(false);

const selectedEngineIdRaw = ref<EngineId | undefined>(undefined);
const selectedEngineId = computed({
Expand Down
55 changes: 36 additions & 19 deletions src/components/Sing/menuBarData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,42 @@ export const useMenuBarData = () => {
await store.dispatch("EXPORT_WAVE_FILE", {});
};

const fileSubMenuData = computed<MenuItemData[]>(() => [
{
type: "button",
label: "音声を出力",
onClick: () => {
void exportWaveFile();
},
disableWhenUiLocked: true,
},
{ type: "separator" },
{
type: "button",
label: "インポート",
onClick: () => {
void importExternalSongProject();
},
disableWhenUiLocked: true,
},
]);
const exportStemWaveFile = async () => {
if (uiLocked.value) return;
sevenc-nanashi marked this conversation as resolved.
Show resolved Hide resolved
await store.dispatch("EXPORT_STEM_WAVE_FILE", {});
};

const fileSubMenuData = computed<MenuItemData[]>(() =>
(
[
{
type: "button",
label: "音声を出力",
onClick: () => {
void exportWaveFile();
},
disableWhenUiLocked: true,
},
store.state.experimentalSetting.enableMultiTrack && {
type: "button",
label: "トラックごとに音声を出力",
onClick: () => {
void exportStemWaveFile();
},
disableWhenUiLocked: true,
},
{ type: "separator" },
{
type: "button",
label: "インポート",
onClick: () => {
void importExternalSongProject();
},
disableWhenUiLocked: true,
},
] satisfies (MenuItemData | false)[]
).filter((item) => !!item),
);

const editSubMenuData = computed<MenuItemData[]>(() => [
{ type: "separator" },
Expand Down
1 change: 1 addition & 0 deletions src/store/setting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const settingStoreState: SettingStoreState = {
exportText: false,
outputStereo: false,
audioOutputDevice: "default",
songTrackFileNamePattern: "",
},
hotkeySettings: [],
toolbarSetting: [],
Expand Down
Loading
Loading