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
This commit is contained in:
2026-08-12 22:12:43 +07:00
parent c3368d0a91
commit d8f8506077
37 changed files with 2170 additions and 419 deletions
+48 -10
View File
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.20)
project(daw_vst_bridge LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# ── 1. VST3 SDK (Steinberg, vendored as git submodule — NOT in vcpkg) ──
@@ -19,15 +19,24 @@ endif()
# Linux/macOS: pkg-config duoc dung (spec goc).
if(WIN32)
find_path(FLUIDSYNTH_INCLUDE_DIR fluidsynth.h)
find_library(FLUIDSYNTH_LIBRARY NAMES fluidsynth libfluidsynth)
find_library(FLUIDSYNTH_LIBRARY NAMES fluidsynth libfluidsynth libfluidsynth-3)
if(NOT FLUIDSYNTH_INCLUDE_DIR OR NOT FLUIDSYNTH_LIBRARY)
message(FATAL_ERROR "fluidsynth not found — cai qua vcpkg: vcpkg install fluidsynth")
endif()
# sfizz: header sfizz.hpp + lib sfizz (vcpkg export target sfizz::sfizz neu co)
find_path(SFIZZ_INCLUDE_DIR sfizz.hpp)
find_library(SFIZZ_LIBRARY NAMES sfizz)
if(NOT SFIZZ_INCLUDE_DIR OR NOT SFIZZ_LIBRARY)
message(FATAL_ERROR "sfizz not found — cai qua vcpkg: vcpkg install sfizz")
# sfizz: built from source (native_bridge/sfizz-src, see build/_sfizz.bat) —
# the sfizz port is NOT in vcpkg upstream. Fall back to vcpkg if present.
set(SFIZZ_SRC_BUILD "${CMAKE_CURRENT_SOURCE_DIR}/sfizz-src/build/library/lib/Release")
if(EXISTS "${SFIZZ_SRC_BUILD}/sfizz_static.lib")
file(GLOB SFIZZ_SRC_LIBS "${SFIZZ_SRC_BUILD}/*.lib")
set(SFIZZ_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/sfizz-src/src")
set(SFIZZ_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/sfizz-src/src")
set(SFIZZ_LIBRARY ${SFIZZ_SRC_LIBS})
else()
find_path(SFIZZ_INCLUDE_DIR sfizz.hpp)
find_library(SFIZZ_LIBRARY NAMES sfizz)
if(NOT SFIZZ_INCLUDE_DIR OR NOT SFIZZ_LIBRARY)
message(FATAL_ERROR "sfizz not found — build native_bridge/sfizz-src first")
endif()
endif()
else()
find_package(PkgConfig REQUIRED)
@@ -37,18 +46,27 @@ endif()
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/include
${FLUIDSYNTH_INCLUDE_DIRS}
${SFIZZ_INCLUDE_DIRS}
${FLUIDSYNTH_INCLUDE_DIR}
${SFIZZ_INCLUDE_DIR}
)
add_executable(daw_vst_bridge
src/main.cpp
src/NativeInstrumentEngine.cpp
src/SharedMemoryIPC.cpp
src/Vst3Instrument.cpp
)
# VST3 SDK hosting: sdk_hosting lacks the platform module loader — module_win32.cpp
# is added to the bridge itself (same approach as the audiohost sample).
if(VST3_SDK_TARGET)
target_link_libraries(daw_vst_bridge PRIVATE ${VST3_SDK_TARGET})
target_compile_definitions(daw_vst_bridge PRIVATE HAVE_VST3SDK=1)
target_link_libraries(daw_vst_bridge PRIVATE ${VST3_SDK_TARGET} sdk_hosting)
if(WIN32)
target_sources(daw_vst_bridge PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/vst3sdk/public.sdk/source/vst/hosting/module_win32.cpp
)
endif()
endif()
if(WIN32)
target_link_libraries(daw_vst_bridge PRIVATE ${FLUIDSYNTH_LIBRARY} ${SFIZZ_LIBRARY})
@@ -57,3 +75,23 @@ if(WIN32)
else()
target_link_libraries(daw_vst_bridge PRIVATE ${FLUIDSYNTH_LIBRARIES} ${SFIZZ_LIBRARIES})
endif()
# ── gui_probe: standalone VST3 GUI attach probe (debug tool, not shipped) ──
add_executable(gui_probe
src/gui_probe.cpp
src/NativeInstrumentEngine.cpp
src/SharedMemoryIPC.cpp
src/Vst3Instrument.cpp
)
if(VST3_SDK_TARGET)
target_compile_definitions(gui_probe PRIVATE HAVE_VST3SDK=1)
target_link_libraries(gui_probe PRIVATE ${VST3_SDK_TARGET} sdk_hosting)
if(WIN32)
target_sources(gui_probe PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/vst3sdk/public.sdk/source/vst/hosting/module_win32.cpp
)
endif()
endif()
if(WIN32)
target_link_libraries(gui_probe PRIVATE ${FLUIDSYNTH_LIBRARY} ${SFIZZ_LIBRARY} winmm)
endif()