fix: MIDI item playback respects visual duration + scale flicker guard

This commit is contained in:
2026-07-25 20:14:53 +07:00
parent 8fdf93f5d1
commit 8d83a46e08
2 changed files with 7 additions and 3 deletions
+3
View File
@@ -5221,6 +5221,7 @@ const PianoRollTabEditor = ({ st, zoom, bpm, viewportWidth, onClose, onUpdateNot
const ids = draggedNote.selectedNoteIds || [];
const firstStart = draggedNote.firstStart;
const notesBefore = notesBeforeDragRef.current;
if (!notesBefore) return;
setNotes(prev => prev.map(n => {
if (!ids.includes(n.id)) return n;
const orig = notesBefore ? notesBefore.find(o => o.id === n.id) : null;
@@ -9428,10 +9429,12 @@ const App = () => {
const bpmVal = parseInt(bpm) || 120;
const secondsPerBeat = 60.0 / bpmVal;
midiItems.forEach(item => {
const itemEndSec = item.startTime + (item.duration || 4);
const notes = item.notes || [];
notes.forEach(note => {
// note start/duration is in beats (for MIDI items)
const noteStartSec = item.startTime + (note.start_beat || 0) * secondsPerBeat;
if (noteStartSec >= itemEndSec) return; // skip notes outside item's visual duration
const noteDurSec = (note.duration_beats || 1) * secondsPerBeat;
const noteEndSec = noteStartSec + noteDurSec;
if (offsetTime < noteEndSec) {
File diff suppressed because one or more lines are too long