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
+15 -9
View File
@@ -233,9 +233,13 @@
}
var engKey = (sfId || '') + ':' + bank + ':' + program;
if (!_engineChMap[engKey]) {
var allocCh = this.allocateChannel(bank);
_engineChMap[engKey] = allocCh;
channel = allocCh;
if (channel === undefined || channel === null) {
var allocCh = this.allocateChannel(bank);
_engineChMap[engKey] = allocCh;
channel = allocCh;
} else {
_engineChMap[engKey] = channel;
}
} else {
channel = _engineChMap[engKey];
}
@@ -363,12 +367,14 @@
if (synthEngine) {
usedBank = synthEngine.soundfont_bank || 0;
usedProg = synthEngine.soundfont_program || 0;
var engKey = (synthEngine.soundfont_id || '') + ':' + usedBank + ':' + usedProg;
var mappedCh = _engineChMap[engKey];
if (mappedCh !== undefined) {
ch = mappedCh;
} else if (ch === undefined) {
ch = usedBank === 128 ? 9 : 0;
if (ch === undefined) {
var engKey = (synthEngine.soundfont_id || '') + ':' + usedBank + ':' + usedProg;
var mappedCh = _engineChMap[engKey];
if (mappedCh !== undefined) {
ch = mappedCh;
} else {
ch = usedBank === 128 ? 9 : 0;
}
}
if (ch === undefined) ch = (usedBank === 128 ? 9 : 0);
var sfHandle = synthEngine.soundfont_id ? _sfHandleMap.get(synthEngine.soundfont_id) : undefined;