-
Notifications
You must be signed in to change notification settings - Fork 304
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
ソング:再生位置の表示形式を変更できるようにする #2306
Merged
Hiroshiba
merged 23 commits into
VOICEVOX:main
from
sigprogramming:display_playhead_position_in_mbsr_format
Oct 28, 2024
Merged
ソング:再生位置の表示形式を変更できるようにする #2306
Changes from 21 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
9f648aa
MBSR形式で表示するように変更、秒とMBSRどちらで表示するかを切り替えられるようにした
sigprogramming 63336c1
拍と16分が1始まりになるように修正、コメントを追加
sigprogramming c41505b
修正、MBSRからMBSに変更
sigprogramming 4563324
tickからMBSに変換する処理をdomain.tsに移動
sigprogramming 4e9c638
変数名とclass名を変更
sigprogramming 6c35780
小節.拍.100分に変更、MBS型からMeasuresBeats型に変更
sigprogramming 840eab3
右クリックメニューの表記を変更
sigprogramming 613cf65
再生ヘッド位置の表示モードが設定として保存されるようにした
sigprogramming 725d0d0
デフォルトの表示モードを秒に変更[update snapshots]
sigprogramming f370ccb
displayModeからdisplayFormatに変更、リファクタリング
sigprogramming 802a8f0
関数を削除
sigprogramming 13365c1
Update src/components/Sing/PlayheadPositionDisplay.vue
sigprogramming 4055aca
再生ヘッド位置の取得・設定処理をコンポーザブル化
sigprogramming 06a8af7
SCREAMING_SNAKE_CASEに変更
sigprogramming 3f9f201
修正
sigprogramming aa96997
Merge branch 'main' into display_playhead_position_in_mbsr_format
sigprogramming a52bd76
playheadPositionをRefにして、FrequentlyUpdatedStateとusePlayheadPositionを削除
sigprogramming 6c3e1c2
MeasuresBeatsを移動
sigprogramming c6eeed2
PLAYHEAD_POSITIONの同期処理を削除
sigprogramming ba88ed9
displayFormatのチェックを行っているところを削除、importのところが変更できていなかったので修正
sigprogramming dd7c1b4
tpqnのバリデーション処理が間違っていたので修正
sigprogramming 4d63b33
// オートスクロールの位置変更
Hiroshiba 83fc8ba
Merge remote-tracking branch 'upstream/main' into pr/sigprogramming/2…
Hiroshiba File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
<template> | ||
<div> | ||
<div v-if="displayFormat === 'MINUTES_SECONDS'" class="playhead-position"> | ||
<div>{{ minAndSecStr }}</div> | ||
<div class="millisec">.{{ milliSecStr }}</div> | ||
</div> | ||
<div v-if="displayFormat === 'MEASURES_BEATS'" class="playhead-position"> | ||
<div>{{ measuresStr }}.</div> | ||
<div>{{ beatsIntegerPartStr }}</div> | ||
<div class="beats-fractional-part">.{{ beatsFractionalPartStr }}</div> | ||
</div> | ||
<ContextMenu ref="contextMenu" :menudata="contextMenuData" /> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ref, computed } from "vue"; | ||
import { useStore } from "@/store"; | ||
import ContextMenu, { | ||
ContextMenuItemData, | ||
} from "@/components/Menu/ContextMenu.vue"; | ||
import { | ||
getTimeSignaturePositions, | ||
MeasuresBeats, | ||
ticksToMeasuresBeats, | ||
} from "@/sing/domain"; | ||
import { useRootMiscSetting } from "@/composables/useRootMiscSetting"; | ||
|
||
const store = useStore(); | ||
|
||
const playheadTicks = computed(() => store.getters.PLAYHEAD_POSITION); | ||
const [displayFormat, setDisplayFormat] = useRootMiscSetting( | ||
store, | ||
"playheadPositionDisplayFormat", | ||
); | ||
|
||
const timeSignatures = computed(() => { | ||
const tpqn = store.state.tpqn; | ||
const timeSignatures = store.state.timeSignatures; | ||
const tsPositions = getTimeSignaturePositions(timeSignatures, tpqn); | ||
return timeSignatures.map((value, index) => ({ | ||
...value, | ||
position: tsPositions[index], | ||
})); | ||
}); | ||
|
||
const measuresBeats = computed((): MeasuresBeats => { | ||
const tpqn = store.state.tpqn; | ||
return ticksToMeasuresBeats(playheadTicks.value, timeSignatures.value, tpqn); | ||
}); | ||
|
||
const measuresStr = computed(() => { | ||
return measuresBeats.value.measures >= 0 | ||
? String(measuresBeats.value.measures).padStart(3, "0") | ||
: String(measuresBeats.value.measures); | ||
}); | ||
|
||
const beatsIntegerPartStr = computed(() => { | ||
const integerPart = Math.floor(measuresBeats.value.beats); | ||
return String(integerPart).padStart(2, "0"); | ||
}); | ||
|
||
const beatsFractionalPartStr = computed(() => { | ||
const integerPart = Math.floor(measuresBeats.value.beats); | ||
const fractionalPart = Math.floor( | ||
(measuresBeats.value.beats - integerPart) * 100, | ||
); | ||
return String(fractionalPart).padStart(2, "0"); | ||
}); | ||
|
||
const minAndSecStr = computed(() => { | ||
const ticks = playheadTicks.value; | ||
const time = store.getters.TICK_TO_SECOND(ticks); | ||
const intTime = Math.trunc(time); | ||
const min = Math.trunc(intTime / 60); | ||
const minStr = String(min).padStart(2, "0"); | ||
const secStr = String(intTime - min * 60).padStart(2, "0"); | ||
return `${minStr}:${secStr}`; | ||
}); | ||
|
||
const milliSecStr = computed(() => { | ||
const ticks = playheadTicks.value; | ||
const time = store.getters.TICK_TO_SECOND(ticks); | ||
const intTime = Math.trunc(time); | ||
const milliSec = Math.trunc((time - intTime) * 1000); | ||
const milliSecStr = String(milliSec).padStart(3, "0"); | ||
return milliSecStr; | ||
}); | ||
|
||
const contextMenu = ref<InstanceType<typeof ContextMenu>>(); | ||
const contextMenuData = computed<ContextMenuItemData[]>(() => { | ||
return [ | ||
{ | ||
type: "button", | ||
label: "分:秒", | ||
disabled: displayFormat.value === "MINUTES_SECONDS", | ||
onClick: async () => { | ||
contextMenu.value?.hide(); | ||
setDisplayFormat("MINUTES_SECONDS"); | ||
}, | ||
disableWhenUiLocked: false, | ||
}, | ||
{ | ||
type: "button", | ||
label: "小節.拍", | ||
disabled: displayFormat.value === "MEASURES_BEATS", | ||
onClick: async () => { | ||
contextMenu.value?.hide(); | ||
setDisplayFormat("MEASURES_BEATS"); | ||
}, | ||
disableWhenUiLocked: false, | ||
}, | ||
]; | ||
}); | ||
</script> | ||
|
||
<style scoped lang="scss"> | ||
@use "@/styles/v2/variables" as vars; | ||
@use "@/styles/colors" as colors; | ||
|
||
.playhead-position { | ||
align-items: center; | ||
display: flex; | ||
font-weight: 700; | ||
font-size: 28px; | ||
color: var(--scheme-color-on-surface); | ||
} | ||
|
||
.millisec { | ||
font-size: 16px; | ||
margin: 10px 0 0 2px; | ||
} | ||
|
||
.beats-fractional-part { | ||
font-size: 16px; | ||
margin: 10px 0 0 2px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(割とただのコメントです)
ここの更新速度が早すぎて、若干目が使えるなと感じました!
ただまあ、別にこれでいい感じなのかなーとも思ってます。どうしようもない!