diff --git a/app/static/js/app.jsx b/app/static/js/app.jsx index 335fe66..d6e589d 100644 --- a/app/static/js/app.jsx +++ b/app/static/js/app.jsx @@ -6658,7 +6658,16 @@ const App = () => { try { const ar = activeTabRef && subTabsRef && subTabsRef.current.find(s => s.id === activeTabRef.current && s.type === 'PIANO_ROLL' && s.isArmed); if (ar && window.SonicSF) { - window.SonicSF.playNote(pitch, velocity, 500, undefined, ar.instrumentProgram, null); + window.SonicSF.playNote(pitch, velocity, 500, undefined, ar.instrumentProgram, null, undefined, ar.synth_engine); + } else if (window.SonicSF) { + // No armed PIANO_ROLL tab — check main session for armed track + const armedTrack = activeTracksRef.current ? activeTracksRef.current.find(t => t.isArmed) : null; + if (armedTrack) { + const prog = armedTrack.instrumentProgram; + const se = armedTrack.synth_engine; + const dest = activeTrackNodesRef.current[armedTrack.id]?.gainNode || null; + window.SonicSF.playNote(pitch, velocity, 500, undefined, prog, dest, undefined, se); + } } } catch (e) {} } else if (cmd === 0x8 || (cmd === 0x9 && velocity === 0)) { diff --git a/wiki.md b/wiki.md index 3bf83fd..27263c6 100644 --- a/wiki.md +++ b/wiki.md @@ -1,3 +1,9 @@ +### [2026-07-26 17:20] Task: MIDI keyboard plays selected instrument on armed main track +- **Tóm tắt thay đổi:** Khi ARM track trong MAIN SESSION/SECTION-TAB, nhấn MIDI Keyboard sẽ play note với instrument đã chọn (synth_engine/instrumentProgram). Fallback: nếu không có sub-tab PIANO_ROLL nào đang armed, tìm track đã ARM trong main session và dùng instrument của nó. Audio routing qua track's gainNode nếu có. +- **Các file ảnh hưởng:** `app/static/js/app.jsx` +- **Ghi chú/Test (nếu có):** ARM track → chọn SF instrument → bấm MIDI keyboard → nghe âm thanh instrument đã chọn. +--- + ### [2026-07-26 17:10] Task: Add Drum channel toggle on track panel - **Tóm tắt thay đổi:** Thêm button 🥁 trên track panel (giữa Solo và Record) để chuyển track sang drum channel 9. Khi active: set `is_percussion=true`, `soundfont_bank=128`. Thêm 🥁 indicator cho percussion presets (bank=128) trong instrument selector. - **Các file ảnh hưởng:** `app/static/js/app.jsx`