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: ソングの書き出しダイアログを追加 #2287

Merged
merged 32 commits into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
3bc974b
Add: ソングの書き出しダイアログを追加
sevenc-nanashi Oct 6, 2024
746e911
Add: ダイアログを完成させる
sevenc-nanashi Oct 8, 2024
2da6078
Add: パラメータ適用以外は実装
sevenc-nanashi Oct 8, 2024
a6c489a
Merge: main -> add/song-export-dialog
sevenc-nanashi Oct 8, 2024
f257ac7
Add: 書き出せるように
sevenc-nanashi Oct 8, 2024
d2da407
Change: wave -> audio
sevenc-nanashi Oct 8, 2024
38b3449
Add: wav以外の書き出しを追加
sevenc-nanashi Oct 8, 2024
235c8c0
Change: メモ -> NOTE
sevenc-nanashi Oct 8, 2024
e0546f1
Fix: ファイル名のプレビューを修正
sevenc-nanashi Oct 8, 2024
0e9ffbd
Fix: トーク側のファイル名を修正
sevenc-nanashi Oct 8, 2024
ab10033
Change: DialogStatesに定義を置く
sevenc-nanashi Oct 8, 2024
3074f3f
Add: 出力ポップアップを追加
sevenc-nanashi Oct 8, 2024
5865b94
Fix: プレビューを修正
sevenc-nanashi Oct 9, 2024
dea09c3
Delete: フォーマット選択を削除
sevenc-nanashi Oct 10, 2024
e77378e
Change: テキストを変える
sevenc-nanashi Oct 10, 2024
c7e81a9
Update: 色々更新
sevenc-nanashi Oct 10, 2024
fe0338e
Change: モノラル時はpan=0を使う用に
sevenc-nanashi Oct 10, 2024
4cdd363
Change: ステレオでandをかける
sevenc-nanashi Oct 10, 2024
a037a42
Change: wav -> WAV
sevenc-nanashi Oct 10, 2024
96a7298
Code: コメントを変える
sevenc-nanashi Oct 10, 2024
0e250f7
Change: 書き出し -> 書き出す
sevenc-nanashi Oct 10, 2024
e8e75fd
Code: コメントを追加
sevenc-nanashi Oct 10, 2024
8be9c4d
Revert: package-lock.jsonの変更を戻す
sevenc-nanashi Oct 10, 2024
e49714f
Change: TrackParametersをstore/type.tsに移動
sevenc-nanashi Oct 10, 2024
f62c512
Change: isMonoに
sevenc-nanashi Oct 10, 2024
a134148
Code: コメントを追加
sevenc-nanashi Oct 10, 2024
04fb7ff
Fix: デフォルト値を修正
sevenc-nanashi Oct 10, 2024
7685fd8
Fix: 条件を修正
sevenc-nanashi Oct 11, 2024
6a40314
Improvr: テキストをいい感じにする
sevenc-nanashi Oct 11, 2024
ed909fc
Change: isStereo -> isMono
sevenc-nanashi Oct 11, 2024
7a01ce6
Improve: モノラル書き出しをオンにするとパンが無効化されるように
sevenc-nanashi Oct 12, 2024
b693b20
微調整
Hiroshiba Oct 12, 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
11 changes: 11 additions & 0 deletions src/components/Dialog/AllDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<UpdateNotificationDialogContainer
:canOpenDialog="canOpenNotificationDialog"
/>
<ExportSongAudioDialog v-model="isExportSongAudioDialogOpen" />
<ImportSongProjectDialog v-model="isImportSongProjectDialogOpenComputed" />
</template>

Expand All @@ -39,6 +40,7 @@ import DictionaryManageDialog from "@/components/Dialog/DictionaryManageDialog.v
import EngineManageDialog from "@/components/Dialog/EngineManageDialog.vue";
import UpdateNotificationDialogContainer from "@/components/Dialog/UpdateNotificationDialog/Container.vue";
import ImportSongProjectDialog from "@/components/Dialog/ImportSongProjectDialog.vue";
import ExportSongAudioDialog from "@/components/Dialog/ExportSongAudioDialog/Container.vue";
import { useStore } from "@/store";
import { filterCharacterInfosByStyleType } from "@/store/utility";

Expand Down Expand Up @@ -159,6 +161,15 @@ const canOpenNotificationDialog = computed(() => {
);
});

// ソングのオーディオエクスポート時の設定ダイアログ
const isExportSongAudioDialogOpen = computed({
get: () => store.state.isExportSongAudioDialogOpen,
set: (val) =>
store.dispatch("SET_DIALOG_OPEN", {
isExportSongAudioDialogOpen: val,
}),
});

// ソングのプロジェクトファイルのインポート時の設定ダイアログ
const isImportSongProjectDialogOpenComputed = computed({
get: () => store.state.isImportSongProjectDialogOpen,
Expand Down
41 changes: 41 additions & 0 deletions src/components/Dialog/ExportSongAudioDialog/BaseCell.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<template>
Copy link
Member

Choose a reason for hiding this comment

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

コピーしたことがわかるように、ちょっとメモ書きだけ書いときますか!

Suggested change
<template>
<!-- SettingDialogのBaseCellを参考にして作成 -->
<template>

こういうメモあった方がいいのかない方がいいのかわかんないですね。。。
ま、まあ、気が向けば・・・!

Copy link
Member Author

Choose a reason for hiding this comment

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

気が向かない(というよりあってもそんなに特が無い気がする)のでパスします。

Copy link
Member

Choose a reason for hiding this comment

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

了解です!
確かにあってもあんま無駄な気がしますが、ここにたどり着いたコミッターの方には便利だと思うので、ちょっとこちらで書いてみますね!

<QCardActions :class="props.class">
<div>{{ title }}</div>
<div :aria-label="description">
<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"
>
{{ description }}
</QTooltip>
</QIcon>
</div>
<QSpace />
<slot />
</QCardActions>
</template>

<script setup lang="ts">
export type Props = {
title: string;
description: string;
class?: unknown; // 型はquasarの定義を真似ている
};

const props = defineProps<Props>();
</script>

<style scoped lang="scss">
@use "@/styles/visually-hidden" as visually-hidden;
@use "@/styles/colors" as colors;

.help-hover-icon {
margin-left: 6px;
color: colors.$display;
opacity: 0.5;
}
</style>
27 changes: 27 additions & 0 deletions src/components/Dialog/ExportSongAudioDialog/Container.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<template>
<Presentation v-model="modelValue" @exportAudio="handleExportAudio" />
</template>

<script setup lang="ts">
import Presentation, { ExportTarget } from "./Presentation.vue";
import { useStore } from "@/store";
import { SongExportSetting } from "@/store/type";

defineOptions({
name: "ExportSongAudioDialog",
});

const modelValue = defineModel<boolean>();
const store = useStore();

const handleExportAudio = (
target: ExportTarget,
setting: SongExportSetting,
) => {
if (target === "master") {
void store.dispatch("EXPORT_AUDIO_FILE", { setting });
} else {
void store.dispatch("EXPORT_STEM_AUDIO_FILE", { setting });
}
};
</script>
192 changes: 192 additions & 0 deletions src/components/Dialog/ExportSongAudioDialog/Presentation.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
<template>
<QDialog ref="dialogRef" v-model="modelValue">
<QCard class="q-py-sm q-px-md dialog-card">
<QCardSection>
<div class="text-h5">書き出し</div>
</QCardSection>

<QSeparator />

<QCardSection>
<BaseCell
title="書き出し対象"
description="すべてのトラックをまとめて書き出すか、トラックごとに書き出すか選べます。"
>
<QBtnToggle
v-model="exportTarget"
:options="exportTargets"
padding="xs md"
unelevated
color="surface"
textColor="display"
toggleColor="primary"
toggleTextColor="display-on-primary"
dense
/>
</BaseCell>
<!-- TODO:実装する
sevenc-nanashi marked this conversation as resolved.
Show resolved Hide resolved
<BaseCell
title="フォーマット"
description="書き出す音声ファイルのフォーマットを選べます。"
>
<QBtnToggle
v-model="audioFormat"
:options="supportedFormats"
padding="xs md"
unelevated
color="surface"
textColor="display"
toggleColor="primary"
toggleTextColor="display-on-primary"
dense
/>
</BaseCell> -->
<BaseCell
title="音声をステレオ化"
description="ONの場合、音声データがモノラルからステレオに変換されてから保存が行われます。"
>
<QToggle v-model="isStereo" />
sevenc-nanashi marked this conversation as resolved.
Show resolved Hide resolved
</BaseCell>
sigprogramming marked this conversation as resolved.
Show resolved Hide resolved
<BaseCell
title="音声のサンプリングレート"
description="音声のサンプリングレートを変更できます。"
Comment on lines +34 to +35
Copy link
Contributor

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でやります。

>
<QSelect
v-model="samplingRate"
dense
name="samplingRate"
:options="samplingRateOptions"
:optionLabel="renderSamplingRateLabel"
>
</QSelect>
</BaseCell>
<BaseCell
title="リミッターを適用する"
description="ONの場合、音量が制限されます。"
>
<QToggle v-model="withLimiter" />
</BaseCell>
sevenc-nanashi marked this conversation as resolved.
Show resolved Hide resolved
<BaseCell
title="トラックのパラメーターを適用する"
description="OFFの場合、VOICEVOX内のパン、ボリューム、ミュート設定が適用されません。"
>
<QToggle v-model="withTrackParameters" />
</BaseCell>
</QCardSection>

<QSeparator />

<QCardActions>
<QSpace />
<QBtn
unelevated
align="right"
label="キャンセル"
color="toolbar-button"
textColor="toolbar-button-display"
class="text-no-wrap text-bold q-mr-sm"
@click="handleCancel"
/>
<QBtn
unelevated
align="right"
label="書き出し"
sevenc-nanashi marked this conversation as resolved.
Show resolved Hide resolved
color="toolbar-button"
textColor="toolbar-button-display"
class="text-no-wrap text-bold q-mr-sm"
@click="handleExportTrack"
/>
</QCardActions>
</QCard>
</QDialog>
</template>

<script setup lang="ts">
// メモ:前回の設定を引き継ぐため、他のダイアログでやっているようなinitializeValuesはやらない
sevenc-nanashi marked this conversation as resolved.
Show resolved Hide resolved
import { ref } from "vue";
import { useDialogPluginComponent } from "quasar";
import BaseCell from "./BaseCell.vue";
import { SongSupportedAudioFormat, SongExportSetting } from "@/store/type";

export type ExportTarget = "master" | "stem";
const { dialogRef, onDialogOK, onDialogCancel } = useDialogPluginComponent();

const modelValue = defineModel<boolean>();
const emit = defineEmits<{
/** 音声をエクスポートするときに呼ばれる */
exportAudio: [exportTarget: ExportTarget, setting: SongExportSetting];
}>();

// 書き出し対象選択
const exportTargets = [
{
label: "すべてのトラック",
value: "master",
},
{
label: "トラックごと",
value: "stem",
},
];
const exportTarget = ref<ExportTarget>("master");

// ステレオ
const isStereo = ref<boolean>(true);

// フォーマット選択
const audioFormat = ref<SongSupportedAudioFormat>("wav");
// const supportedFormats = [
// {
// label: "WAV",
// value: "wav",
// },
// {
// label: "mp3",
// value: "mp3",
// },
// {
// label: "ogg",
// value: "ogg",
// },
// ];
sevenc-nanashi marked this conversation as resolved.
Show resolved Hide resolved

// サンプルレート
const samplingRate = ref<number>(48000);
const samplingRateOptions = [24000, 44100, 48000, 88200, 96000];
const renderSamplingRateLabel = (rate: number) => `${rate} Hz`;

// リミッター
const withLimiter = ref<boolean>(true);

// パン・ボリューム・ミュート
const withTrackParameters = ref<boolean>(true);

const handleExportTrack = () => {
onDialogOK();
emit("exportAudio", exportTarget.value, {
isStereo: isStereo.value,
sampleRate: samplingRate.value,
audioFormat: audioFormat.value,
withLimiter: withLimiter.value,
withTrackParameters: withTrackParameters.value,
});
};

// キャンセルボタンクリック時
const handleCancel = () => {
onDialogCancel();
modelValue.value = false;
};
</script>

<style scoped lang="scss">
.dialog-card {
width: 700px;
max-width: 80vw;
}

.scrollable-area {
overflow-y: auto;
max-height: calc(100vh - 100px - 295px);
}
</style>
Hiroshiba marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--
<!--
アップデート通知ダイアログのコンテナ。
スキップしたバージョンより新しいバージョンがあれば、ダイアログを表示する。
-->
Expand Down
3 changes: 1 addition & 2 deletions src/components/Sing/SingEditor.vue
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 @@ -12,9 +12,8 @@
v-if="nowRendering"
padding="xs md"
label="音声の書き出しをキャンセル"
color="surface"
textColor="display"
class="q-mt-sm"
outline
@click="cancelExport"
/>
</div>
Expand Down
21 changes: 5 additions & 16 deletions src/components/Sing/menuBarData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,19 @@ export const useMenuBarData = () => {
});
};

const exportWaveFile = async () => {
const exportAudioFile = async () => {
if (uiLocked.value) return;
await store.dispatch("EXPORT_WAVE_FILE", {});
};

const exportStemWaveFile = async () => {
if (uiLocked.value) return;
await store.dispatch("EXPORT_STEM_WAVE_FILE", {});
await store.dispatch("SET_DIALOG_OPEN", {
isExportSongAudioDialogOpen: true,
});
};

const fileSubMenuData = computed<MenuItemData[]>(() => [
{
type: "button",
label: "音声を出力",
onClick: () => {
void exportWaveFile();
},
disableWhenUiLocked: true,
},
{
type: "button",
label: "トラックごとに音声を出力",
onClick: () => {
void exportStemWaveFile();
void exportAudioFile();
},
disableWhenUiLocked: true,
},
Expand Down
sevenc-nanashi marked this conversation as resolved.
Show resolved Hide resolved
File renamed without changes.
Loading
Loading