feat: silent fallback when no instrument — no oscillator default

_playNoteFluid no-instrument branch previously called
_playNoteFallback (sine wave oscillator). Changed to
silent return. User explicitly requested no default sound.
This commit is contained in:
2026-07-28 09:28:21 +07:00
parent 2dec94aa7e
commit 6fa6578dd1
2 changed files with 7 additions and 6 deletions
+1 -6
View File
@@ -393,12 +393,7 @@
_fluidModule._fluid_synth_program_change(_synthPtr, ch, usedProg); _fluidModule._fluid_synth_program_change(_synthPtr, ch, usedProg);
} catch (e) {} } catch (e) {}
} else { } else {
// No instrument configured: use oscillator fallback directly. // No instrument configured: silent — no FluidSynth, no oscillator.
// Do NOT call program_change(ch, 0) — FluidSynth would pick
// program 0 from whatever SoundFont is loaded (could be
// another track's SF), causing cross-track instrument leak.
var ctx = getCtx();
self._playNoteFallback(note, velocity, durationMs, startTime, undefined, null, channel, undefined);
return; return;
} }
if (ch === undefined) ch = (usedBank === 128 ? 9 : 0); if (ch === undefined) ch = (usedBank === 128 ? 9 : 0);
+6
View File
@@ -539,6 +539,12 @@
- **Ghi chú/Test (nếu có):** `npm run build` pass. Ctrl+Click+Drag section/MIDI item → copy đến vị trí mới, item không bị selected. - **Ghi chú/Test (nếu có):** `npm run build` pass. Ctrl+Click+Drag section/MIDI item → copy đến vị trí mới, item không bị selected.
--- ---
### [2026-07-28 09:27] Task: Silent fallback — không nghe âm thanh mặc định
- **Tóm tắt thay đổi:** Thay oscillator fallback bằng silent return trong `_playNoteFluid` (soundfontPlayer.js:395). Khi không có instrument data, không play bất kỳ âm thanh nào (cả oscillator lẫn FluidSynth).
- **Các file ảnh hưởng:** `app/static/js/services/soundfontPlayer.js`
- **Ghi chú/Test (nếu có):** Section sub-track MIDI items không instrument → im lặng. MAIN track MIDI items không instrument → GM Piano (program 0).
---
### [2026-07-28 09:25] Task: Restore program default 0 cho MAIN track MIDI playback ### [2026-07-28 09:25] Task: Restore program default 0 cho MAIN track MIDI playback
- **Tóm tắt thay đổi:** Restore line 10283 `instrumentProgram !== undefined ? instrumentProgram : 0` — MAIN track MIDI items cần program 0 để play (GM Piano) khi không load instrument. Chỉ section sub-track (line 10393) giữ `subTrack.instrumentProgram` (undefined → oscillator fallback) để tránh load MAIN SoundFont. - **Tóm tắt thay đổi:** Restore line 10283 `instrumentProgram !== undefined ? instrumentProgram : 0` — MAIN track MIDI items cần program 0 để play (GM Piano) khi không load instrument. Chỉ section sub-track (line 10393) giữ `subTrack.instrumentProgram` (undefined → oscillator fallback) để tránh load MAIN SoundFont.
- **Các file ảnh hưởng:** `app/static/js/app.jsx`, `app/static/js/app.precompiled.js` - **Các file ảnh hưởng:** `app/static/js/app.jsx`, `app/static/js/app.precompiled.js`