fix: ARM nhiều track phát sai instrument - synth_engine của track là nguồn quyết định thay vì channel state (bỏ che mask khi channel giữ instrument cũ/trùng)
This commit is contained in:
@@ -424,18 +424,15 @@
|
||||
var finalProg = usedProg;
|
||||
var finalSfId = synthEngine ? synthEngine.soundfont_id : undefined;
|
||||
var cachedCh = _channels[ch];
|
||||
// A channel explicitly configured with a soundfont (via
|
||||
// selectInstrument) is authoritative. But the default channel
|
||||
// state (bank 0, program 0, no soundfont) must NOT mask the
|
||||
// track's synth engine or the note's program — otherwise notes
|
||||
// on a freshly-picked instrument are silently dropped.
|
||||
if (cachedCh && cachedCh.sfId !== undefined) {
|
||||
// The note's own synth engine (track instrument) is
|
||||
// authoritative. Channel state is only a cache: it must never
|
||||
// mask the track's instrument, otherwise multi-track ARM or a
|
||||
// re-picked instrument plays the wrong soundfont. Without an
|
||||
// engine, fall back to the soundfont configured on the channel.
|
||||
if (!synthEngine && cachedCh && cachedCh.sfId !== undefined) {
|
||||
finalBank = cachedCh.bank;
|
||||
finalProg = cachedCh.program;
|
||||
finalSfId = cachedCh.sfId;
|
||||
} else if (!synthEngine && program !== undefined && cachedCh && cachedCh.program !== undefined && cachedCh.program !== 0 && cachedCh.program !== null) {
|
||||
finalBank = cachedCh.bank;
|
||||
finalProg = cachedCh.program;
|
||||
}
|
||||
// Ensure the soundfont is actually loaded before the note plays.
|
||||
// Quick instrument pick on a track does not pre-load it, so load
|
||||
|
||||
Reference in New Issue
Block a user