Commit Graph

57 Commits

Author SHA1 Message Date
admin f3fd0109a7 V45.2 fix Qin silence (20s audio-thread stall) + SF loop downbeat delay
- SandboxVst2Host::loadSerializedState: queuePreset non-blocking (byte-identical
  echo never matched -> waitApply always burned 20s TIMEOUT on the audio thread;
  VST2 restore runs via runOnMain so every startup silenced ALL audio ~20s = Qin
  'failed that su'). Bridge now holds reloading + defers saveStateJob until the
  child republishes a different chunk (clobber protection, no audio block).
- sf-fx-realtime clear_queue('loop'): truncate old tail to KEEP=4 blocks
  (~21ms) instead of keeping FILL 24 (~128ms) -> wrap downbeat no longer ~110ms
  late; skipFade crossfade masks the truncation jump, seam crossfade recount.
- bump ?v= 202608291721 (app.jsx x2, index.html x2); deploy 3 _internal + dist.
2026-08-29 17:25:32 +07:00
admin e7e974b3e0 Fix GUI Qin không hiện lại sau hide + âm thanh lỗi sau khi đóng cửa sổ
- plugin_host_main.cpp: chặn WM_CLOSE (đóng GUI nhưng giữ window sống, hide
  thay vì destroy), WM_DESTROY reset hwnd; dùng g_hostHwnd toàn cục thay
  hwnd local để control OPEN_GUI/CLOSE_GUI tái sử dụng đúng window.
- main.cpp: bỏ qua dedupe hasAttachedView cho instrument child-own
  (SandboxVst2Host) — bridge guiOpen_ stale sau khi child tự đóng nên
  OPEN_GUI lặp lại phải forward control 4; child tự chặn double-open.
- Verify: WM_CLOSE -> window ẩn còn sống; OPEN_GUI lần 2 -> window hiện lại,
  âm ch1 vẫn kêu (peak 0.15), không câm.
2026-08-21 09:21:56 +07:00
admin a7b01d3484 fix(bridge): 3 bug âm thanh Qin/Nexus standalone
1) wavesynth tự phát khi mở app: probe calibrate() render vào live mix
   (renderAll process cùng instance) -> thêm calibratingCh_[16], renderAll
   bỏ qua channel đang calibrate; plugin_host panic (sustain off + all
   notes off + 128 noteOff) ngay sau preset apply để startup im lặng.
2) bấm GUI mở 2 cửa sổ Qin: sandbox VST2 child tự sở hữu top-level window
   -> ownsGuiWindow() + main.cpp forward OPEN_GUI control, không tạo native
   parent / không registry double-open.
3) play phát nhạc cụ sai: restore clobber — seed preset đè patch thật trong
   state file (ch3 63ba3667 -> 7f07473c) do saveStateJob chạy lúc child còn
   seed. Fix: queuePreset(waitApply=true) chờ child apply xong (presetOut
   memcmp), consume-before-apply (zero presetInLen trước khi apply), deferred
   double-load re-check trong main.cpp skip assign trùng path, watchdog
   respawn re-queue lastPreset_.
2026-08-21 08:50:28 +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 d6649e4474 bridge: auto-create jBridge Qin settings (RUN_IN_EXISTING_AUXHOST 0)
Makes the unlimited-Qin fix durable: bridge writes
%APPDATA%\jBridge\SettingsFilesFor{64,32}BitPlugins\Qin_RV.jBridge
at startup when missing, so every Qin instance runs in its own
auxhost on any machine. Verified: 4 Qin ch0/1/2/9 live, 4 auxhost.exe,
0 ML_RELEASE_ERROR, GUI attachView ok=1 on all.
2026-08-20 11:14:39 +07:00
admin c78d9f2911 bridge: drop 2-instance Qin cap (jBridge per-plugin settings fix)
Qin bridges via jBridge shared auxhost; 3rd live instance flooded
ML_RELEASE_ERROR (engine per-auxhost capacity, not our code). Fix:
write %APPDATA%\jBridge\SettingsFilesFor64BitPlugins\Qin_RV.jBridge
with RUN_IN_EXISTING_AUXHOST 0 -> each instance gets own auxhost,
unlimited tracks. Remove LOAD REJECT/restore SKIP guards. Verified:
4 Qin ch0/1/2/9 live, 4 auxhost.exe, 0 ML_RELEASE_ERROR, GUI all attach.
2026-08-20 11:11:27 +07:00
admin 588c0da32d native_bridge: recalibrate after preset restore, reject 3rd live VST2 instance 2026-08-20 10:50:11 +07:00
admin 4932bb88db fix(bridge): restore VST2 preset chunk on respawn + offline render (Qin silent fix) 2026-08-20 10:18:18 +07:00
admin 45a7bdebfa Phase 0 (PLAN_MASTERBUS_FX_RACK_VST): banner ra stderr de stdout sach cho --scan JSON / --fx-gui port
Test /c/tmp/test_fx_phase0.py: 7/7 pass — gain0 bit-exact, gain -6dB RMS/2,
normalize peak<=0.25, empty chain rc=1, Ozone 11 Maximizer VST3 render khac
input (88172 samples), --scan phan loai dung (Ozone is_fx, Scaler 2 instrument).
2026-08-19 21:16:01 +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 6efef85e47 fix(bridge): VST2 host dung ABI SDK — crash outs>2, NaN input, editOpen(NULL), opcodes; docs A14 MIDI-out + phan tich Ozone -Inf
- aeffect.h: bo sung opcodes 4-22, 53, 55 + audioMaster 15/41-44 + ERect (dung chuan VST2.4 SDK, DUNE load OK khong crash)
- Vst2Instrument: cap du pointer arrays theo numInputs/numOutputs (fix AV 0xC0000005 Qin outs=32), input fill 0.0f (het NaN poison effect), bo probe effEditOpen(NULL) (crash WaveObserver), GetDirectory + SizeWindow hook, canDo sendVstEvents/sendVstTimeInfo
- TASKS.md: A14 MIDI-out tu plugin (Scaler2/Instacomposer/MelodicFlow xuat MIDI khong phai audio)
- PLAN_MASTERBUS_FX_RACK_VST.md: phan tich Ozone -Inf — chain day du, nguyen nhan = audio DAW khong chay qua bridge master ring
2026-08-19 20:57:16 +07:00
admin 2bbe80efa3 fix(bridge): set ringMask=7 on Windows — ring collapsed to 1 slot (slot = writeIndex & 0), dropped audio blocks on GUI jank 2026-08-19 11:20:39 +07:00
admin da0f8fa40e feat(native): realtime master FX chain + fx-gui fast start, hide/show, non-topmost
- FxGuiServer: HWND_TOP (no longer always-on-top), /hide + /show endpoints,
  onStarted callback prints SF_FXGUI_PORT before plugin load (fast connect)
- RenderFxJob: RealtimeFxChain (mutex+worker, SEH-guarded, bypass slots,
  deferred Vst3Fx dtor); --fx-gui split into parse/create/load-attach stages
- main: FreeConsole unless SF_KEEP_CONSOLE; control type 6 SET_FX_CHAIN feeds
  g_fxChain on the audio loop; shutdown before CoUninitialize
- plugins.py: CREATE_NO_WINDOW on both Popen paths
- lib.rs: set_fx_chain command -> push_control(6)
- app.jsx/nativeBridgeService: setFxChain sync from MasteringModal; panel close
  uses /hide + refs to fix closure bug; VstGuiEmbed rect refresh -> /show
2026-08-19 09:59:13 +07:00
admin 351ee56080 fix(bridge): load dung VSTi theo track (V9) - bo early-return mui theo flag, load qua Tauri invoke khi co path, guard path sai (WaveObserver vs Nexus), chi mo GUI khi load OK; sync 6 ban JS + index.html ?v; kem cac fix bridge truoc (bugs 1-4, GUI restore) 2026-08-18 16:56:05 +07:00
3dtours c382afe2a6 feat: embed native VST GUI in mastering + fx rack panels (bridge --fx-gui frame capture + input relay)
Linux parts (0L1-4L1 per TASKS_LINUX_WINDOWS.md):
- native_bridge: FxGuiServer.cpp HTTP server (Winsock) — /frame BitBlt +
  PrintWindow fallback -> JPEG (libjpeg-turbo q70), /input PostMessage relay
  (mouse/wheel/key, coords scaled), /close, /ping; RenderFxJob fxGuiSetup +
  run_fx_gui_server (offscreen); main.cpp --fx-gui dispatch; vcpkg +
  CMakeLists WIN32-only + JPEG.
- api: open_fx_gui embed flag spawn --fx-gui, parse SF_FXGUI_PORT -> embed_url,
  fx-gui/close endpoint; 4 unit tests.
- ui: VstGuiEmbed component (frame refresh 100ms, ping 2s, input relay,
  scale coords) shared by MasteringModal + FXRackModal; swap graph<->GUI,
  cleanup on unmount, dead-bridge toast fallback.
- docs: TASKS_LINUX_WINDOWS.md, WALKTHROUGH_WINDOWS.md, PLAN status.
Windows tasks 0W1-4W1 remain (build + E2E real VST).
2026-08-17 22:37:55 +07:00
admin 38f4cbd8b5 feat: open native VST FX GUI from mastering panel + FX rack (bridge --open-fx-gui) 2026-08-17 21:52:40 +07:00
admin b261eb0d7e feat: VST FX rack per-track + masterbus render via native_bridge 2026-08-17 21:31:57 +07:00
admin e79dae5d5c phase4: Linux native_bridge build (Docker) — sfizz from source, --render SF2/SFZ
- Dockerfile: build sfizz tu native_bridge/sfizz-src (hoac git clone v1.2.3),
  sed fix sfizz.pc (-llibsfizz -> -lsfizz), cmake bridge voi 3 flag SMTG OFF
  (VSTGUI/plugin/hosting examples) — bridge headless chi can --render.
- CMakeLists: nhanh non-WIN32 build daw_vst_bridge tu main_linux.cpp +
  RenderJob.cpp + NativeInstrumentEngine.cpp (SF2/SF3 + SFZ; VST3/VST2
  hosting Windows-only, guard #ifdef _WIN32). gui_probe/plugin_host/
  seh_channel_test chi build tren Windows.
- RenderJob.cpp: JSON parser (sheredom json.h) khong con phu thuoc
  HAVE_VST3SDK — render SF2/SFZ chay duoc khong can VST3 SDK.
- NativeInstrumentEngine.cpp: guard windows.h/VST3/VST2/Sandbox/SEH.
- main.cpp: g_engine unconditional + guard disable_ime_contexts (_WIN32).
- engine.spec: bo pedalboard collect_dynamic_libs + hidden imports.
- vst_engine/render_engine: DecentSampler -> NotImplementedError + huong
  dan convert .dspreset -> .vstpreset; pianobook fallback synth.
- Verified: WSL Ubuntu 24.04 build OK, bridge Linux --render SF2 ra WAV
  44100 stereo peak 1575; Python tests 115 passed 1 skipped.
- Dockerfile build chua test duoc (may khong co Docker).
2026-08-17 11:46:24 +07:00
admin 0cca84c5f9 feat(bridge): add --render offline CLI (Phase 0 of pedalboard replacement)
daw_vst_bridge --render <job.json> --out <clip.wav> renders MIDI notes
through the same instrument engines as realtime (SF2/SFZ/VST3/VST2) to a
16-bit stereo WAV, headless, no SHM. Mirrors plugins.py/vst_engine.py
note semantics (velocity int(vel*127), bank CC0 + program at t=0, beatSec
60/max(30,bpm), totalNeeded max(1024,endSample), no tail). Chunk clamped
to 256 to match VST3 host prepared buffers. Uses vendored sheredom json.h
(gated on HAVE_VST3SDK); rc: 0 ok, 1 arg/job error, 2 load fail, 3 crash.
Partial output removed on failure. Verified: SF2, SFZ, Nexus VST3 render
non-silent at exact duration; 9/9 tests pass.
2026-08-17 08:04:25 +07:00
admin 4111995a5c Add VST2 hosting to native bridge; fix CC7 data2 routing verified via SHM test
VST2 (Steinberg 2.4 ABI) host via Vst2Instrument: aeffect.h, dispatcher,
process events/replacing, kEffectStartProcess, headless GUI skip.
- create_instrument returns Vst2Instrument for InstrumentType::VST2
- 64B-aligned scratch buffers for SIMD plugins; SEH crash capture module+stack
- plugins.py: VST2 resolves .dll/.so; vst_engine.py reports VST2 type
- app.jsx: derive instrumentType from scan (VST3 vs VST2), not hardcoded
- Install exes refreshed from Release build

SF2 FluidSynth audio verified end-to-end through SHM ring (energy 1.33):
silence was a test-harness bug (CC7 value written to velocity field, bridge
reads data2) — app sends data2 correctly. All temporary diagnostics removed.
2026-08-17 07:55:46 +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 7bcaf19c28 feat(vst-gui): open VST3 GUI while playing (level 1)
- main.cpp: drop transportStopped defer in handleOpenGui (G0.1 legacy);
  G0.1b setReloading-before-job + single UiThread (G1.2) block the
  2-thread-1-DLL race. GUI opens immediately during PLAY, short mute
  (~0.1-0.3s first time, hasAttachedOnce_ false so reloadForGUI skips
  reload); notes already sounding are kept. Reopen after close still
  reloads (1-3s mute) - level 2 not feasible.
- app.jsx: remove !isPlayingRef.current guard before openNativeGUI in
  loadTrackInstrumentToBridge.
- rebuild app.precompiled.js + daw_vst_bridge.exe.
2026-08-16 17:27:38 +07:00
admin c29e024372 fix: stale-reload watchdog — force-unmute channel stuck in reloading >20s (60s if close/attach in flight) (V9) 2026-08-16 16:15:41 +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 761b48e41f fix 5.2 audit findings on Windows: F-PROC-1 injection, F-MEM-5 UAF, F-PROC-2 restart race, F-PROC-3, F5, F6 2026-08-16 12:29:42 +07:00
admin 30fa98a441 G3.1: dedicated bridge heartbeat — watchdog liveness independent of audio loop 2026-08-16 10:04:16 +07:00
admin d31312e824 G2.2: flush bridge state to disk before kill (control type=5 DUMP + Rust pre-kill) 2026-08-16 07:52:01 +07:00
admin c2ae452844 G2.4: skip redundant LOAD of already-loaded instrument (keep restored preset) 2026-08-16 07:47:53 +07:00
admin 4faa5a3504 G2.3: auto-reload instruments from state file after bridge respawn 2026-08-16 07:33:14 +07:00
admin 28441566c2 G2.1: save full instrument state to disk (path/type/preset/transport) 2026-08-16 07:28:17 +07:00
admin c813481357 G1.4: dong bo comment voi code - bo ghi chu mute-when-editor-open con sot (dispatch channelQuiet, attach job); ghi ro reloading_ chi mute khi createView/createInstance chay 2026-08-15 21:49:00 +07:00
admin 7629783298 G1.4: bo mute-when-editor-open - channelQuiet chi con reloading; xoa editorOpen machinery (g_editorOpen/g_editorPathCount/clear_editor_open/setEditorOpenPredicate); audio loop process() binh thuong khi editor mo 2026-08-15 21:28:16 +07:00
admin b92c85ec73 G1.3: bo pump gate cu (is_teardown_window/g_ownerTid/g_juceOwnerTids/g_tidToWorker/post_and_wait) — 1 UiThread khong con race teardown-pump; CBT hook chi tren UiThread; destroy_window_on_owner destroy truc tiep 2026-08-15 21:18:49 +07:00
admin 9e6e72ac27 G1.2: 1 UiThread chung thay 16 ChannelWorker (COM STA + message pump + job queue); window+attach job tren UiThread; audio loop bo PeekMessageW; Option B close dong bo qua close_editor_now 2026-08-15 21:02:18 +07:00
admin eac7f2feb8 G0.4: save/restore preset quanh reload khi close GUI (captureState/restoreState, memorystream link truc tiep) 2026-08-15 20:04:56 +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 18394807a9 fix GUI VSTi khi PLAY: defer OPEN_GUI + silence same-path truoc attach (G0.1) 2026-08-15 18:44:02 +07:00
admin 67e73a2a85 fix GUI VSTi mute/reopen/not-load: revert walkthrough 2 ve hanh vi 0cec3d3 (reloadForGUI reload-on-reopen, closeGUI khong goi view->removed(), post_close_gui reload-on-close + same-plugin silence + destroy children + pathBusy, editorOpenPredicate refcount mute, CoInitializeEx MTA, window main-thread), giu cai tien an toan (WM_ERASEBKGND/PAINT/SIZE chong trang, resizeView, call_once, jobEvent_/MsgWaitForMultipleObjects pump 128, ABOVE_NORMAL + PowerThrottling worker, setBypassed quanh assign/unload); queryInterface giu kNoInterface nhu 0cec3d3 — VERIFIED: probe_fix_flow PASS (mo GUI Nexus -> close -> reopen khong mute, load Ample khi GUI dang mo OK, screenshot khong trang); warning: driver stress test 6 Nexus cung luc crash xac suat CA tren exe stable 0cec3d3 (khong phai regression) 2026-08-15 17:50:18 +07:00
admin f94b2fa757 wip walkthrough 2 bridge: jobEvent_/MsgWaitForMultipleObjects pump, SetThreadPriority + PowerThrottling, isBypassed silence quanh assign/unload, closeGUI view->removed(), reloadForGUI reuse instance, bo mute khi GUI mo, CoInitializeEx MTA — CHƯA verified: driver test 1/3 PASS (AV c0000005 Nexus!GetPluginFactory luc attachView ch5, nghi MTA/bo mute), exe deploy giu ban 0cec3d3 (28104a47) 2026-08-15 17:11:47 +07:00
admin 0cec3d3cce fix GUI VSTi trắng/không load: DPI per-monitor v2 + WS_CLIPCHILDREN + view->onSize() sau attached; restore API manager header/cpp (2596372 xoá nhầm) và deploy exe mới 2026-08-15 16:12:29 +07:00
admin 90241f626f fix crash daw_vst_bridge 0xc000041d khi mở GUI Nexus rồi switch sang Ample: over-gate JUCE message window (g_juceOwnerTids, chỉ chạy khi close_in_flight) + gỡ VEH tạm và mọi log [dbg] chẩn đoán, giữ [NativeBridge] production; deploy exe FINAL (đã verify 3 run driver) 2026-08-15 11:35:50 +07:00
3dtours 2596372ab1 fix crash bridge khi đổi SF→VSTi đang play: silence same-plugin theo path MỚI trước assign() (createInstance) — track restore giữ cùng DLL process song song audio loop = 2 threads 1 DLL Nexus crash; không tự mở GUI khi đang play (C++ mute channel tới khi đóng GUI → tắt âm) 2026-08-14 17:08:17 +07:00
admin af59aaf257 fix crash daw_vst_bridge khi đóng editor Nexus đang play: reload instance trong close job + silence same-plugin quanh createInstance/createView 2026-08-14 16:52:53 +07:00
admin 0696545ae9 fix: bridge crash/stall when opening native VST GUI while playing
- Fix A (USER32 crash): WM_CLOSE no longer destroys the native VST
  window from the main thread (plugin editor children live on the
  channel worker thread). WM_CLOSE -> hide + closeGUI on worker;
  WM_DESTROY erases registry. LOAD_INSTRUMENT close uses closeGUI +
  SW_HIDE, waits on hasAttachedView() instead of registry erase.
- Fix B: per-process SHM name SonicForge_DAW_IPC_{pid} so stale
  bridges from old builds can never attach to a new app's ring buffer.
- Fix C (stall): opening editor for a plugin whose other channel still
  has a live instance of the same DLL (Nexus) deadlocked the audio
  loop (reload+createView on worker while audio thread processed the
  other instance). Silence same-path channels via setReloading during
  reload/attach, restore afterwards; audio resumes.
- Rebuild bridge + update install/ portable package.
2026-08-14 14:36:34 +07:00
admin 35499b614c fix(bridge): VSTi GUI crash on instrument switch — PostMessage WM_CLOSE instead of cross-thread DestroyWindow
- LOAD job posts WM_CLOSE to window created on main thread (DestroyWindow from worker crashed 0xc000041d, muting all tracks)
- handleOpenGui + attach jobs skip when Vst3Instrument::hasAttachedView() (state_ && guiAttached_)
- attach failure posts WM_CLOSE; post_close_gui erases entry only when it points at the same hwnd
- cap openVstGuiRetry at 5 to stop frontend retry spam
2026-08-14 10:18:22 +07:00
admin 29f7fecb35 fix(ui): GUI button inline same row + same height as Synth/File/FX in TCP 2026-08-14 08:04:33 +07:00
admin 7a8122f99d fix(v9): 5 bugs — GUI deferred until VST loaded (no white window), fixed retry 8x500ms, VST3 folder resolve for auto-load, sustain-CC64 dropped after STOP, taskkill process tree on exit, Synth+GUI same row in TCP 2026-08-13 21:57:23 +07:00
admin 96d31ee685 fix(v8): 5 bugs — orphan bridge watchdog+state overwrite, stuck-note stop race, white VST GUI retry, VSTi auto-load via saved plugin_path, track-header button overflow
- native bridge: dedicated watchdog thread (parent death / PID-reuse via GetProcessTimes) -> TerminateProcess self; transportStopped flag drops note-on after STOP + CC64 sustain release + allNotesOff on stop
- tauri: set_bridge_child overwrites managed BridgeProcess state (app.manage is no-op when state exists) so Destroyed handler kills restarted bridge
- ui: stopAllPlayback syncs isPlayingRef/subTabsRef + second transport stop at 150ms; onStatusChange resets __bridgeLoadedChannels at callback start (auto-restart never emits bridge-down); openVstGuiRetry waits for async C++ load before OPEN_GUI; loadVstToBridge uses synth_engine.plugin_path / listPlugins fallback and persists plugin_path on load; shrink track-header Synth/GUI buttons
2026-08-13 21:14:31 +07:00
admin 55d232c659 fix(bridge): closeGUI on channel worker thread — WM_DESTROY runs on main, view->removed() must run on the worker apartment or plugin corrupts and next attach hangs 2026-08-13 17:06:32 +07:00
admin 2c890aef54 fix(bridge): noteId match noteOn (0) for noteOff; create VST GUI window on main thread, attach on worker 2026-08-13 16:33:46 +07:00