Metronome off by default; scroll piano roll to playhead on seek
2 changed files+5−2
src/audio/player.tsmodified+1−1View file
@@ -41,7 +41,7 @@ class Player {
4141 version = 0;
4242 state: TransportState = 'stopped';
4343 posSec = 0;
44- metronome = true;
44+ metronome = false;
4545 preparing = false;
4646
4747 subscribe = (cb: () => void): (() => void) => {
src/components/PianoRoll.tsxmodified+4−1View file
@@ -76,6 +76,7 @@ export function PianoRoll() {
7676 const pitchToY = (p: number) => RULER_H + (PITCH_MAX - p) * KEY_H - view.current.scrollY;
7777 const yToPitch = (y: number) => PITCH_MAX - Math.floor((y + view.current.scrollY - RULER_H) / KEY_H);
7878
79+ let lastDrawnPos = -1;
7980 const draw = () => {
8081 raf = requestAnimationFrame(draw);
8182 const ctx = canvas.getContext('2d');
@@ -96,7 +97,9 @@ export function PianoRoll() {
9697 // playhead position and auto-scroll
9798 const posSec = Math.max(0, player.getPositionSec());
9899 const playTick = tm.secToTick(posSec);
99- if (player.state !== 'stopped') {
100+ const posChanged = posSec !== lastDrawnPos;
101+ lastDrawnPos = posSec;
102+ if (player.state !== 'stopped' || posChanged) {
100103 const px = tickToX(song, playTick);
101104 if (px > width - 40 || px < KEYS_W) {
102105 view.current.scrollX = Math.max(0, playTick * pxPerTick(song) - 80);