fix: MIDI auto-play đọc nhầm file cũ, canvas/audio không đồng bộ
This commit is contained in:
@@ -9334,6 +9334,9 @@ const MediaExplorerPanel = ({ height }) => {
|
||||
if (synthInst && window.SonicSF.selectInstrument) {
|
||||
try { await window.SonicSF.selectInstrument(0, bank, program, sfId); } catch (e2) {}
|
||||
}
|
||||
// Re-check token after the async await — stale playMidiPreview (older file)
|
||||
// must not schedule notes over the newly selected file.
|
||||
if (selectTokenRef.current !== (token || selectTokenRef.current)) return;
|
||||
const prog = (synthInst && synthInst.program !== undefined) ? synthInst.program : undefined;
|
||||
const eng = synthInst ? { soundfont_id: sfId, soundfont_bank: bank, soundfont_program: prog !== undefined ? prog : 0 } : undefined;
|
||||
midiResult.forEach(track => {
|
||||
|
||||
Reference in New Issue
Block a user