mirror of
https://github.com/MrPatben8/konduktor.git
synced 2026-11-27 10:22:51 +01:00
Grid can now be nudged by one beat
This commit is contained in:
1 parent
85f01f6723
commit
513808a6d2
2 files changed
+12
No files matched your search
@@ -211,6 +211,7 @@ export function GridEditStrip({
|
|||||||
onPrevMarker,
|
onPrevMarker,
|
||||||
onNextMarker,
|
onNextMarker,
|
||||||
onNudgeMarker,
|
onNudgeMarker,
|
||||||
|
onNudgeMarkerBeats,
|
||||||
onAddMarker,
|
onAddMarker,
|
||||||
onDeleteMarker,
|
onDeleteMarker,
|
||||||
onDeleteGrid,
|
onDeleteGrid,
|
||||||
@@ -225,6 +226,7 @@ export function GridEditStrip({
|
|||||||
onPrevMarker: () => void
|
onPrevMarker: () => void
|
||||||
onNextMarker: () => void
|
onNextMarker: () => void
|
||||||
onNudgeMarker: (deltaMs: number) => void
|
onNudgeMarker: (deltaMs: number) => void
|
||||||
|
onNudgeMarkerBeats: (beats: number) => void
|
||||||
onAddMarker: () => void
|
onAddMarker: () => void
|
||||||
onDeleteMarker: () => void
|
onDeleteMarker: () => void
|
||||||
onDeleteGrid: () => void
|
onDeleteGrid: () => void
|
||||||
@@ -273,6 +275,8 @@ export function GridEditStrip({
|
|||||||
<div className="glass-group flex h-10 shrink-0 items-center overflow-hidden rounded-xl">
|
<div className="glass-group flex h-10 shrink-0 items-center overflow-hidden rounded-xl">
|
||||||
{/* Phase nudges move the GOVERNING marker — not gated on atMarker,
|
{/* Phase nudges move the GOVERNING marker — not gated on atMarker,
|
||||||
since the drift is heard at the playhead, not at the marker. */}
|
since the drift is heard at the playhead, not at the marker. */}
|
||||||
|
<button className={nudge} onClick={() => onNudgeMarkerBeats(-1)} disabled={!hasGrid} title="Move the marker −1 beat">-1b</button>
|
||||||
|
<span aria-hidden className="h-[18px] w-px bg-line" />
|
||||||
<button className={nudge} onClick={() => onNudgeMarker(-10)} disabled={!hasGrid} title="Move the marker −10 ms">−10</button>
|
<button className={nudge} onClick={() => onNudgeMarker(-10)} disabled={!hasGrid} title="Move the marker −10 ms">−10</button>
|
||||||
<button className={nudge} onClick={() => onNudgeMarker(-1)} disabled={!hasGrid} title="Move the marker −1 ms">−1</button>
|
<button className={nudge} onClick={() => onNudgeMarker(-1)} disabled={!hasGrid} title="Move the marker −1 ms">−1</button>
|
||||||
<button
|
<button
|
||||||
@@ -285,6 +289,8 @@ export function GridEditStrip({
|
|||||||
</button>
|
</button>
|
||||||
<button className={nudge} onClick={() => onNudgeMarker(1)} disabled={!hasGrid} title="Move the marker +1 ms">+1</button>
|
<button className={nudge} onClick={() => onNudgeMarker(1)} disabled={!hasGrid} title="Move the marker +1 ms">+1</button>
|
||||||
<button className={nudge} onClick={() => onNudgeMarker(10)} disabled={!hasGrid} title="Move the marker +10 ms">+10</button>
|
<button className={nudge} onClick={() => onNudgeMarker(10)} disabled={!hasGrid} title="Move the marker +10 ms">+10</button>
|
||||||
|
<span aria-hidden className="h-[18px] w-px bg-line" />
|
||||||
|
<button className={nudge} onClick={() => onNudgeMarkerBeats(1)} disabled={!hasGrid} title="Move the marker +1 beat">+1b</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Only a marker you are standing on can be deleted, so one scrolled
|
{/* Only a marker you are standing on can be deleted, so one scrolled
|
||||||
|
|||||||
@@ -881,6 +881,11 @@ export function PrepStrip({
|
|||||||
// in this panel — a section can be octave-wrong on its own.
|
// in this panel — a section can be octave-wrong on its own.
|
||||||
const halveBpm = () => activeMarker && setBpm(activeMarker.bpm / 2)
|
const halveBpm = () => activeMarker && setBpm(activeMarker.bpm / 2)
|
||||||
const doubleBpm = () => activeMarker && setBpm(activeMarker.bpm * 2)
|
const doubleBpm = () => activeMarker && setBpm(activeMarker.bpm * 2)
|
||||||
|
// A beat is the governing marker's own beat: moving a marker by whole beats
|
||||||
|
// shifts which beat is the downbeat without changing the phase.
|
||||||
|
const nudgeGridBeats = (beats: number) => {
|
||||||
|
if (activeMarker) nudgeGrid((beats * 60000) / activeMarker.bpm)
|
||||||
|
}
|
||||||
const nudgeGrid = (deltaMs: number) => {
|
const nudgeGrid = (deltaMs: number) => {
|
||||||
if (!activeMarker) return
|
if (!activeMarker) return
|
||||||
editMarker(activeMarkerIndex, { start: Math.max(0, activeMarker.start + deltaMs / 1000) })
|
editMarker(activeMarkerIndex, { start: Math.max(0, activeMarker.start + deltaMs / 1000) })
|
||||||
@@ -1363,6 +1368,7 @@ export function PrepStrip({
|
|||||||
onPrevMarker={prevMarker}
|
onPrevMarker={prevMarker}
|
||||||
onNextMarker={nextMarker}
|
onNextMarker={nextMarker}
|
||||||
onNudgeMarker={nudgeGrid}
|
onNudgeMarker={nudgeGrid}
|
||||||
|
onNudgeMarkerBeats={nudgeGridBeats}
|
||||||
onAddMarker={addMarkerHere}
|
onAddMarker={addMarkerHere}
|
||||||
onDeleteMarker={deleteMarkerHere}
|
onDeleteMarker={deleteMarkerHere}
|
||||||
onDeleteGrid={deleteGrid}
|
onDeleteGrid={deleteGrid}
|
||||||
|
|||||||
Reference in new issue
Block a user