Skip to content

Conversation

@sigprogramming
Copy link
Collaborator

内容

以下を行います。

  • 拍子の位置をTickではなく小節番号で保持するようにする
  • 曲中のテンポ・拍子も考慮して小節の数を算出するようにする
  • 拍子の分母が16以下の2の倍数になるようにする
  • バリデーションの追加
  • リファクタリング

関連 Issue

VOICEVOX/voicevox_project#15

その他

@sigprogramming sigprogramming requested a review from a team as a code owner October 25, 2023 14:10
// 歌声合成エディターの初期化
onMounted(async () => {
await store.dispatch("SET_SCORE", { score: createEmptyScore() });
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

watchが動いていなかったので、ひとまずSET_SCOREを呼んで初期化するようにしました…!

Copy link
Member

@Hiroshiba Hiroshiba left a comment

Choose a reason for hiding this comment

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

LGTM!!!

score、すでにundefinedableじゃなくせそうな気がしたのでちょっと試してみます。

Comment on lines +17 to +18
// NOTE: 戻り値の単位はtick
export function getTimeSignaturePositions(
Copy link
Member

Choose a reason for hiding this comment

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

(もしご興味あればくらいのコメントなのですが)

ブランド型を使えば、tick等のnumberを型で区別可能にできたりします!
といっても全部numberではあるので、関数に間違えて渡したりできなくなる程度のメリットしか無いかもですが・・・。

例えば↓がzod使って秒・ミリ秒・ナノ秒をそれぞれブランド型作る方法です。
https://chat.openai.com/share/85e06c91-586d-4872-835e-1ef91a69e56f

ちなみにEngineIdやSpeakerIdなどは型サポートを受けられるようにブランド型になってたりします。

export const engineIdSchema = z.string().brand<"EngineId">();

Comment on lines +71 to +72
maxTicks = Math.max(maxTicks, lastTsPosition);
maxTicks = Math.max(maxTicks, lastTempoPosition);
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
maxTicks = Math.max(maxTicks, lastTsPosition);
maxTicks = Math.max(maxTicks, lastTempoPosition);
maxTicks = Math.max(maxTicks, lastTsPosition, lastTempoPosition);

@Hiroshiba Hiroshiba merged commit 07cec39 into VOICEVOX:project-s Oct 25, 2023
@sigprogramming sigprogramming deleted the fix_ts_and_refactor branch October 27, 2023 11:32
@sigprogramming sigprogramming restored the fix_ts_and_refactor branch October 27, 2023 11:32
@sigprogramming sigprogramming deleted the fix_ts_and_refactor branch October 27, 2023 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants