12 Commits

Author SHA1 Message Date
admin da7ae02509 fix: VST2 qua jbridge bị tạch tạch — pace child theo consumer-sync + bridge copy full block
Root cause: child plugin_host render ~50x real-time (9323 blocks/s), bridge
đọc slot đang bị child ghi đè (torn read) và mỗi segment của 1 DAW block
đọc từ nhiều child block khác nhau -> discontinuity -> tạch thay vì âm thật.

- SandboxHostIPC: thêm bridgeConsumed[2] cuối struct (append-only, offsets
  cũ giữ nguyên) — child đếm publish/slot, bridge đếm consume/slot.
- plugin_host_main.cpp: sau khi publish 1 block, chờ bridge consume xong
  block đó mới render block kế (wait-sau-publish, không phải wait-trước-
  render — wait-trước vẫn cho phép publish 2 block liên tiếp giữa 2 lần
  consume -> bridge đọc latest sẽ bỏ block). Child giờ publish đúng 1
  block/DAW block = real-time; bridge không bao giờ stall (main loop DAW
  render + pace mọi iteration) nên không deadlock; nếu bridge chết,
  parent_alive break wait.
- SandboxVst2Host: copy full 256 mẫu vào local buffer khi slot đổi, serve
  mọi segment của 1 DAW block từ 1 child block nhất quán.

Verify: child pace 371 blocks/2s (real-time 375, trước 18647); domFreq của
waveform = 257.8Hz đúng nốt C4 (note 60) — âm thật, không phải noise;
correlation giữa các block liên tiếp âm đều ~-0.4 (waveform tuần hoàn);
GUI open path không deadlock (pace vẫn real-time, jBridge dialog + Qin_VST_
Window hiện đủ); GUI đóng -> child idle delta 0; silence_all master peak
0.000016.
2026-08-21 09:43:11 +07:00
admin b91e6d3875 bridge: fix Qin VST2 silent playback via per-child SHM sandbox
- out-of-process VST2 sandbox: each Qin track spawns its own plugin_host.exe child
  with unique SHM (SonicForge_PluginHost2_<bridgePid>_<ch>_<seq>), watchdog <=3 respawns
- preset round-trip bridge<->child over SHM (presetIn/presetOut 64KB), stub rejection MIN_PRESET=100
- seed qin_default.b64 default preset into every fresh child; saved patch wins on restore
- forward MIDI on channel 0 (Qin_RV only listens on ch0); one instrument per child
- controls 4/5/6 = OPEN_GUI/CLOSE_GUI/QUIT
- gitignore runtime carla_projects
2026-08-20 19:16:43 +07:00
admin 6a3b430da0 A14: MIDI-out từ plugin (VST2/VST3) → SHM → Rust emit → DAW track
- Vst2Instrument: audioMaster callback thu VstEvents, push SHM midiOutQueue
- Vst3Instrument: IEventList output bus (kAudioMasterWantMidi) — check
- SharedMemoryIPC.h: midiOutQueue[64] + midiOutCount (offset 27556/28324, sizeof 28328)
- shm.rs: MidiEventIPC Serialize, drain_midi_out() emit 'bridge-midi-out'
- lib.rs: pump emit midi-out events
- nativeBridgeService.js: onMidiOut API
- app.jsx: route MIDI-out về selected track qua SonicMidiRouter (feedback guard)
- TASKS.md: A14 ✅
2026-08-19 21:12:07 +07:00
admin cead8c8c71 fix(vsti): crackle fix P1-P3 — SHM 8-slot ring + drain-delta pump + AudioWorklet sink
- SharedMemoryIPC.h/main.cpp: render into ring slot (idx & ringMask), 8 slots
- shm.rs: ring fields + read_ring_audio; lib.rs pump drains FULL delta, not just latest
- bridgeAudioNode.js: AudioWorklet primary (bridge-audio-sink), ScriptProcessor fallback
- bridgeAudioWorklet.js: ring 64 blocks, underrun fade, overrun drop + crossfade
- layout tests: sizeof 27560 (8-align via u64)
2026-08-16 20:43:50 +07:00
admin b6950d6418 fix: MIDI keyboard preview silent after transport STOP — live flag bypass guard (V8) 2026-08-16 15:43:23 +07:00
admin 9436e66835 G4.3: double-buffer sandbox SHM - SandboxHostIPC writeSlot+2x256 double audio, latency 15.6ms, multi-instance no-xrun verified 2026-08-16 11:35:31 +07:00
admin 462a5104d2 G4.2: bridge-side plugin process pool — SandboxVst3Host spawns/respawns plugin_host.exe per channel, MIDI forward + audio snapshot + watchdog mute/respawn, crash isolation verified 2026-08-16 10:52:04 +07:00
admin 7de00955d8 G4.1: sandbox plugin host (plugin_host.exe) PoC — Nexus runs in child process, GUI + audio via SHM, crash isolation verified 2026-08-16 10:36:01 +07:00
admin 30fa98a441 G3.1: dedicated bridge heartbeat — watchdog liveness independent of audio loop 2026-08-16 10:04:16 +07:00
admin 5313d85926 G0.3: watchdog giu 15s khi attach-in-flight (SHM flag) + RAII guard trong attach job (fix kill nham khi GUI mo) 2026-08-15 19:00:32 +07:00
admin d8f8506077 fix: GUI VST native window qua bridge + audio path bridge (SF2 preview/play câm)
- open_vst_gui: bo WebviewWindowBuilder/thread, chi push_control type=4 (hwnd=0 -> bridge tao window)
- main.cpp: create_native_vst_window (class SonicForge_Native_VST3_Class, 800x600, khong TOPMOST),
  tao trong ChannelWorker job, map guiWindows, capture arg2 by value (fix dangling)
- app.jsx: guard isBridgeActive() 8 cho -> bridge active thi moi note di router -> pushEvent -> bridge
  (truoc day SF2 cam vi HAS_PYFLUIDSYNTH=FALSE -> /soundfont-render 501; VST3 path cu dung nativeSf/Carla)
- E2E: SF2 NOTE_ON qua dispatchMidiEvent -> SHM peak 0.029745; Nexus GUI native hwnd OK (license/preset)
- docs: TASKS.md + TEST_NOTES.md ghi batch fix + ket qua; gitignore vendor/junk
2026-08-12 22:12:43 +07:00
locpham c3368d0a91 feat: native host bridge integration — C++ bridge, Rust SHM, JS routing, build scripts, docs
- native_bridge/: InstrumentEngineManager multi-channel, sample-accurate, CC/program/pitchbend, transport, Vst3Instrument stub (HAVE_VST3SDK)
- src-tauri: shm.rs, bridge spawn + audio pump + health monitor, open_vst_gui, externalBin, commands
- app: UnifiedMidiRouter, NativeBridgeService, bridgeAudioNode, audioRoutingEngine, Plugin Manager UI, Bridge/WASM indicator, set_position sync
- build: 3 ps1 (force-added, build/ ignored), verify_bundle --check-bridge, CI workflow
- docs: TASKS.md, TEST_NOTES.md (Windows verify checklist), install/report updates
2026-08-11 23:37:29 +07:00