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 12 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: 0 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/components/Dialog/Dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ const showWriteErrorDialog = ({
}
};

/** 保存結果に応じてユーザーに通知する。キャンセルされた場合は何もしない。 */
export const notifyResult = (
sevenc-nanashi marked this conversation as resolved.
Show resolved Hide resolved
result: SaveResultObject,
mediaType: MediaType,
Expand Down
32 changes: 20 additions & 12 deletions src/components/Dialog/ExportSongAudioDialog/Presentation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
/>
</BaseCell>
<BaseCell
title="音声をステレオ化"
description="ONの場合、音声データがモノラルからステレオに変換されてから保存が行われます。"
title="モノラルで書き出し"
description="ONの場合、パンが無効化され、1つのチャンネルにまとめられて書き出されます。"
>
<QToggle v-model="isStereo" />
<QToggle v-model="isMono" />
</BaseCell>
<BaseCell
title="音声のサンプリングレート"
Expand Down Expand Up @@ -78,7 +78,7 @@
<QBtn
unelevated
align="right"
label="書き出し"
label="書き出す"
color="toolbar-button"
textColor="toolbar-button-display"
class="text-no-wrap text-bold q-mr-sm"
Expand All @@ -94,8 +94,7 @@
import { ref, computed } from "vue";
import { useDialogPluginComponent } from "quasar";
import BaseCell from "./BaseCell.vue";
import { SongExportSetting } from "@/store/type";
import { TrackParameters } from "@/store/singing";
import { SongExportSetting, TrackParameters } from "@/store/type";

export type ExportTarget = "master" | "stem";
const { dialogRef, onDialogOK, onDialogCancel } = useDialogPluginComponent();
Expand All @@ -119,8 +118,8 @@ const exportTargets = [
];
const exportTarget = ref<ExportTarget>("master");

// ステレオ
const isStereo = ref<boolean>(true);
// モノラル
const isMono = ref<boolean>(false);

// サンプルレート
const samplingRate = ref<number>(48000);
Expand All @@ -131,16 +130,25 @@ const renderSamplingRateLabel = (rate: number) => `${rate} Hz`;
const withLimiter = ref<boolean>(true);

// パン・ボリューム・ミュート
const withTrackParameters = ref<(keyof TrackParameters)[]>([
const withTrackParametersInner = ref<(keyof TrackParameters)[]>([
"pan",
"gain",
"soloAndMute",
]);
const withTrackParameters = computed({
get: () =>
isMono.value
? withTrackParametersInner.value.filter((v) => v !== "pan")
: withTrackParametersInner.value,
set: (value: (keyof TrackParameters)[]) => {
withTrackParametersInner.value = value;
},
});
const trackParameterOptions = computed(() => [
{
label: "パン",
value: "pan",
disable: !isStereo.value,
disable: isMono.value,
},
{
label: "ボリューム",
Expand All @@ -155,11 +163,11 @@ const trackParameterOptions = computed(() => [
const handleExportTrack = () => {
onDialogOK();
emit("exportAudio", exportTarget.value, {
isStereo: isStereo.value,
isMono: isMono.value,
sampleRate: samplingRate.value,
withLimiter: withLimiter.value,
withTrackParameters: {
pan: withTrackParameters.value.includes("pan") && isStereo.value,
pan: withTrackParameters.value.includes("pan"),
gain: withTrackParameters.value.includes("gain"),
soloAndMute: withTrackParameters.value.includes("soloAndMute"),
},
Expand Down
13 changes: 4 additions & 9 deletions src/store/singing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
SingingVoiceKey,
EditorFrameAudioQueryKey,
EditorFrameAudioQuery,
TrackParameters,
} from "./type";
import {
buildSongTrackAudioFileNameFromRawData,
Expand Down Expand Up @@ -157,12 +158,6 @@ const generateDefaultSongFileBaseName = (
return DEFAULT_PROJECT_NAME;
};

export type TrackParameters = {
gain: boolean;
pan: boolean;
soloAndMute: boolean;
};

const offlineRenderTracks = async (
numberOfChannels: number,
sampleRate: number,
Expand Down Expand Up @@ -1953,7 +1948,7 @@ export const singingStore = createPartialStore<SingingStoreTypes>({
getters.CHARACTER_INFO,
);
const fileName = `${fileBaseName}.wav`;
const numberOfChannels = setting.isStereo ? 2 : 1;
const numberOfChannels = setting.isMono ? 1 : 2;
const sampleRate = setting.sampleRate;
const withLimiter = setting.withLimiter;

Expand Down Expand Up @@ -2032,7 +2027,7 @@ export const singingStore = createPartialStore<SingingStoreTypes>({
async ({ state, mutations, getters, actions }, { dirPath, setting }) => {
let firstFilePath = "";
const exportAudioFile = async (): Promise<SaveResultObject> => {
const numberOfChannels = setting.isStereo ? 2 : 1;
const numberOfChannels = setting.isMono ? 1 : 2;
const sampleRate = setting.sampleRate;
const withLimiter = setting.withLimiter;

Expand Down Expand Up @@ -2072,7 +2067,7 @@ export const singingStore = createPartialStore<SingingStoreTypes>({
continue;
}

// ミュート/ソロをエクスポートするかどうかとして反映する
// ミュート/ソロにより再生されないトラックは除外
if (
setting.withTrackParameters.soloAndMute &&
!shouldPlays.has(trackId)
Expand Down
9 changes: 7 additions & 2 deletions src/store/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
Store,
} from "./vuex";
import { createCommandMutationTree, PayloadRecipeTree } from "./command";
import { TrackParameters } from "./singing";
import {
AccentPhrase,
AudioQuery,
Expand Down Expand Up @@ -816,8 +815,14 @@ export const PhraseKey = (id: string): PhraseKey => phraseKeySchema.parse(id);

export type SequencerEditTarget = "NOTE" | "PITCH";

export type TrackParameters = {
gain: boolean;
pan: boolean;
soloAndMute: boolean;
};

export type SongExportSetting = {
isStereo: boolean;
isMono: boolean;
sampleRate: number;
withLimiter: boolean;
withTrackParameters: TrackParameters;
Expand Down
1 change: 1 addition & 0 deletions src/type/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,7 @@ export const configSchema = z
savingSetting: z
.object({
fileEncoding: z.enum(["UTF-8", "Shift_JIS"]).default("UTF-8"),
// NOTE: ファイル名パターンは拡張子を含まない
fileNamePattern: z.string().default(""),
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
// NOTE: ファイル名パターンは拡張子を含まない
fileNamePattern: z.string().default(""),
fileNamePattern: z.string().default(""), // NOTE: ファイル名パターンは拡張子を含まない

fixedExportEnabled: z.boolean().default(false),
avoidOverwrite: z.boolean().default(false),
Expand Down
Loading