Commit Graph

15 Commits

Author SHA1 Message Date
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 f7f20e3a0a fix(bridge): stop leaves sound looping — EventList maxSize=50 drops STOP sweep note-offs
Root cause: Steinberg EventList defaults to maxSize=50 events. The STOP
all-notes-off sweep queues 128 note-offs per channel (16ch x 128 pitch),
so addEvent beyond 50 fails silently and the plugin never receives the
remaining note-offs — voices keep sustaining and the transport loops
forever until the bridge process is killed.

Fix: raise eventList.setMaxSize(4096) in loadPlugin. Also assign unique
noteIds per overlapping note-on (stack per pitch) so note-off releases
every voice at that pitch, and log addEvent result + channel in debug
output for verification.
2026-08-14 09:45:50 +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
admin 05e4244cc8 fix(bridge): one editor at a time + guard reload race
- Close other channels' editor windows before attaching a new one (Option B)
- needsReload()/setReloading() guard: skip processAudioBlock during
  terminate+reload teardown to avoid UAF/hang when reopening GUI
- Wait for editor registry cleanup (5s timeout) before creating window
2026-08-13 15:32:35 +07:00
admin c3eb0c9d16 fix: VST3 teardown under lock + re-attach hang + editor window on replace
- InstrumentEngineManager::assign: destroy replaced instrument OUTSIDE mu_
  (VST3 terminate/removed can block -> audio loop stall -> bridge Not
  Responding, transport stop hangs, notes never off)
- main.cpp LOAD job: DestroyWindow any open editor window of the channel
  before assign (replace VSTi -> SF2 with editor alive hung in removed())
- Vst3Instrument: reload() fresh plugin instance on second openGUI after
  close (Nexus etc. hang at view->attached() twice on same component)
2026-08-13 12:48:30 +07:00
admin 3f59c2c4c2 fix: SF2 bank select, midi multi-key cut, VSTi reopen hang, multi-track stuck
- NativeInstrumentEngine: track GM bank per channel (CC0/CC32), use bank in programChange
- app.jsx: send CC0/CC32+PROGRAM before notes via __ensureBridgeProgram, dedupe, clear dedupe after async LOAD
- audioRoutingEngine/bridgeAudioNode: idempotent connect (no disconnect-flush on re-connect), fixes note cut & multi-track stuck
- main.cpp: remove 10s poll in OPEN_GUI control job (blocked realtime loop, watchdog race), VstWindowProc stores channel not inst pointer, cleanup gui maps on WM_DESTROY
2026-08-13 12:19:34 +07:00
admin d168328004 Fix AI proxy origin in Tauri, SF2 program_select, VSTi GUI reopen + sample rate bridge
- aiGateway.js: use window.API_BASE_URL (engine port) instead of window.location.origin (tauri://localhost asset protocol returned index.html -> JSON parse error); check content-type before parsing response
- NativeInstrumentEngine.cpp: fluid_synth_program_select for SF2 instrument + program change
- Vst3Instrument.cpp: activate all audio/event buses, channel=0 forced, GUI resize/reopen, kEvent using fix
- main.cpp: VST GUI reopen via WM_DESTROY, OleInitialize, steady_clock loop
- lib.rs: BridgeSampleRate state, restart_bridge_with_sample_rate command, borrow fix
- app.jsx/nativeBridgeService.js: isMidiTrack widening, bridge masterbus connect, held MIDI notes, sample-rate restart, openNativeGUI channel
2026-08-13 11:26:39 +07:00
locpham 36fb546d58 fix: SF2 sound (audio sink FIFO underrun) + VST3 native GUI open + GUI load race
- bridgeAudioNode: ScriptProcessor 4096 drained only 1 of 16 blocks -> ~94% silence; now drains all queued blocks per callback, RING_DEPTH 8->24
- app.jsx: openNativeGUI had NO caller; wire after VST3 loadInstrument OK in track Synth dropdown + Plugin Manager Load Bridge
- main.cpp: OPEN_GUI polls up to 10s for LOAD completion (worker thread) before attach - fixes race 'no instrument loaded'
- index.html: bump bridgeAudioNode/app.precompiled cache versions
2026-08-12 22:32:10 +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