feat(midi): play selected instrument on armed main track via MIDI keyboard
When MIDI note-on received and no PIANO_ROLL sub-tab is armed, fallback to armed track in main session. Read its synth_engine and instrumentProgram to route audio through correct instrument. Route to track gainNode if available.
This commit is contained in:
+10
-1
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user