fix: per-track instrument + ghost note visibility

soundfontPlayer.js:
- selectInstrument: respect passed channel (don't allocate new one)
- _playNoteFluid: only use _engineChMap when channel is undefined

ghostNoteExtractor.js:
- Include ALL notes from overlapping items (not clipped)
- relative_start_beat can be negative (notes before window)
- Keep original duration instead of clamping
This commit is contained in:
2026-07-27 20:04:56 +07:00
parent e14554a75a
commit 4a9cbcdef1
2 changed files with 18 additions and 16 deletions
+3 -7
View File
@@ -40,17 +40,13 @@
var noteAbsStart = itemStartBeat + (note.start_beat || 0);
var noteAbsEnd = noteAbsStart + (note.duration_beats || 1);
if (noteAbsStart >= windowEndBeat || noteAbsEnd < windowStartBeat) continue;
var clampedStart = Math.max(noteAbsStart, windowStartBeat);
var clampedEnd = Math.min(noteAbsEnd, windowEndBeat);
var clampedDur = clampedEnd - clampedStart;
if (noteAbsStart >= windowEndBeat) continue;
trackGhostNotes.push({
id: 'ghost_' + (note.id || Math.random().toString(36).substr(2, 9)),
pitch: note.pitch,
relative_start_beat: clampedStart - windowStartBeat,
duration_beats: clampedDur,
relative_start_beat: noteAbsStart - windowStartBeat,
duration_beats: (note.duration_beats || 1),
velocity: note.velocity,
original_track_name: track.name,
original_track_color: track.color || '#888888'