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

[release-0.17] hotfix: プロジェクトファイル読み込みと声量・音域パラメータの初期化バグ修正 #1927

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 8 additions & 2 deletions src/components/Sing/SingEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ onetimeWatch(
notes: [],
},
});

// CI上のe2eテストのNemoエンジンには歌手がいないためエラーになるのでワークアラウンド
// FIXME: 歌手をいると見せかけるmock APIを作り、ここのtry catchを削除する
try {
await store.dispatch("SET_SINGER", {});
} catch (e) {
window.backend.logError(e);
}
}

await store.dispatch("SET_VOLUME", { volume: 0.6 });
Expand All @@ -101,8 +109,6 @@ onetimeWatch(
});
isCompletedInitialStartup.value = true;

await store.dispatch("SET_SINGER", {});

Comment on lines -104 to -105
Copy link
Member Author

@Hiroshiba Hiroshiba Mar 9, 2024

Choose a reason for hiding this comment

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

そもそも呼ぶ必要はないはず。
内部でSETUP_SINGERが行われるから呼んでるだけ?
とりあえずプロジェクトファイルが読み込まれてなかった時だけ実行するように移動しました。

return "unwatch";
},
{
Expand Down
25 changes: 16 additions & 9 deletions src/components/Sing/ToolBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@
<script setup lang="ts">
import { computed, watch, ref, onMounted, onUnmounted } from "vue";
import { useStore } from "@/store";
import { isProduction } from "@/type/preload";
Copy link
Member Author

Choose a reason for hiding this comment

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

消し忘れ


import {
getSnapTypes,
Expand Down Expand Up @@ -214,7 +213,7 @@ watch(
() => {
bpmInputBuffer.value = tempos.value[0].bpm;
},
{ deep: true }
{ deep: true, immediate: true }
);

watch(
Expand All @@ -223,16 +222,24 @@ watch(
beatsInputBuffer.value = timeSignatures.value[0].beats;
beatTypeInputBuffer.value = timeSignatures.value[0].beatType;
},
{ deep: true }
{ deep: true, immediate: true }
);

watch(keyRangeAdjustment, () => {
keyRangeAdjustmentInputBuffer.value = keyRangeAdjustment.value;
});
watch(
keyRangeAdjustment,
() => {
keyRangeAdjustmentInputBuffer.value = keyRangeAdjustment.value;
},
{ immediate: true }
);

watch(volumeRangeAdjustment, () => {
volumeRangeAdjustmentInputBuffer.value = volumeRangeAdjustment.value;
});
watch(
volumeRangeAdjustment,
() => {
volumeRangeAdjustmentInputBuffer.value = volumeRangeAdjustment.value;
},
{ immediate: true }
);
Comment on lines -229 to +242
Copy link
Member Author

Choose a reason for hiding this comment

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

immediate: trueをつけました。
プロジェクトファイル読み込み起動だった場合、storeが更新された後にここのコンポーネントがマウントされます。
そのマウントされるタイミングでstoreから値を持ってきてなかったのでバグってた感じです。

そもそもたぶんInputBuffer用の変数は必要ないかもでした。


const setBpmInputBuffer = (bpmStr: string | number | null) => {
const bpmValue = Number(bpmStr);
Expand Down
3 changes: 3 additions & 0 deletions src/store/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ const applySongProjectToStore = async (
await dispatch("SET_KEY_RANGE_ADJUSTMENT", {
keyRangeAdjustment: tracks[0].keyRangeAdjustment,
});
await dispatch("SET_VOLUME_RANGE_ADJUSTMENT", {
volumeRangeAdjustment: tracks[0].volumeRangeAdjustment,
});
Comment on lines +117 to +119
Copy link
Member Author

Choose a reason for hiding this comment

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

プロジェクトファイル読み込んだ後に UI(Store)への反映を忘れていたのがバグの原因。
そもそも同じ状態を保持しているものが2つあるのはこういうことが起こるのでよくないはず。
state.volumeRangeAdjustmentstate.tracks[0].volumeRangeAdjustment
多分片方をGETTERにすれば問題が起こらなくなるはず。

await dispatch("SET_SCORE", {
score: {
tpqn,
Expand Down
Loading