v20: fix CC11 piano roll (epoch check _cc11Epoch - v19 con so _nativePlayEpoch) + SF program change khi play piano roll (bridge)

This commit is contained in:
2026-08-26 18:18:20 +07:00
parent 1f78a834a8
commit 3e6080603c
3 changed files with 13 additions and 4 deletions
+6 -1
View File
@@ -768,7 +768,7 @@ const scheduleNoteExpressionCC11 = (track, note, ch, startWallTime, startSec, du
const delayMs = Math.max(0, wallMs - ctx.currentTime * 1000);
const val = _cc11ValueAt(curve, ratio);
const timer = setTimeout(() => {
if (epoch !== _nativePlayEpoch) return;
if (epoch !== _cc11Epoch) return;
if (window.SonicMidiRouter && window.SonicMidiRouter.isBridgeActive && window.SonicMidiRouter.isBridgeActive()) {
window.SonicMidiRouter.pushEvent({ cmd: 'CC', channel: track ? track.id : 0, pitch: EXPRESSION_CC, velocity: 0, data2: val, percussion: isPerc });
return;
@@ -25510,6 +25510,11 @@ const App = () => {
const mainCh = instCtx.ch;
var allTracks = activeTracksRef.current || [];
ensureSonicInstrument(instCtx);
// Bridge active: gui program change (CC0/CC32/PROGRAM) de SF preset dung
// (instCtx.program undefined cho SF -> __ensureBridgeProgram fallback
// synthEngine.soundfont_program da set khi load qua modal). Thieu ->
// bridge choi preset mac dinh, khong dung preset da chon.
try { if (window.__ensureBridgeProgram) window.__ensureBridgeProgram(st.trackId, instCtx.program, instCtx.synthEngine); } catch (e) {}
console.log('[Play] PianoRoll schedule:', st.id, '| notes=', midiNotes.length, '| track=', st.trackId, '| program=', instrumentProgram, '| sf=', instCtx.sfId ? instCtx.sfId : '-', '| dest=', destNode ? 'ok' : 'null', '| ch=', mainCh, '| sfEngine=', synthEngine ? 'yes' : 'no', '| bypassA=', !!trackAudioBypassMap[st.trackId], '| bypassMidi=', !!trackMidiBypassMap[st.trackId]);
// 0 = item start. Notes must be scheduled relative to the item too, otherwise
// items placed later in the project play `item.startTime` seconds in the