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).
This commit is contained in:
2026-08-17 11:46:24 +07:00
parent efe26e3277
commit e79dae5d5c
10 changed files with 135 additions and 71 deletions
+9 -8
View File
@@ -9,8 +9,10 @@
#include "RenderJob.h"
#include "NativeInstrumentEngine.h"
#ifdef HAVE_VST3SDK
// sheredom/json.h (public domain, vendored with the VST3 SDK) is header-only
// and needed for SF2/SFZ render even without the VST3 SDK — include it directly.
#include "vst3sdk/public.sdk/source/vst/moduleinfo/json.h"
#ifdef HAVE_VST3SDK
#include "public.sdk/source/vst/vstpresetfile.h"
#include "public.sdk/source/common/memorystream.h"
using Steinberg::int32;
@@ -37,7 +39,6 @@ using Steinberg::uint32;
namespace {
#ifdef HAVE_VST3SDK
// --- sheredom/json.h helpers -------------------------------------------------
const json_object_element_s* member(const json_object_s* o, const char* key) {
for (const json_object_element_s* e = o ? o->start : nullptr; e; e = e->next)
@@ -73,7 +74,6 @@ int64_t memberInt(const json_object_s* o, const char* key, int64_t def) {
double d;
return memberNumber(o, key, d) ? (int64_t)d : def;
}
#endif // HAVE_VST3SDK
// --- WAV writer (stdlib only, 16-bit PCM stereo, little-endian) --------------
void writeU16(std::ofstream& f, uint16_t v) {
@@ -247,10 +247,6 @@ int run_render_job(const std::string& jobPath, const std::string& outPath) {
std::remove(outPath.c_str()); // never leave a partial clip behind
};
#ifndef HAVE_VST3SDK
fail("built without the VST3 SDK submodule — JSON parser unavailable, --render disabled");
return rc;
#else
struct RootHolder { json_value_s* p = nullptr; ~RootHolder() { if (p) std::free(p); } } rootH;
// 1. Read + parse the job.
@@ -347,12 +343,18 @@ int run_render_job(const std::string& jobPath, const std::string& outPath) {
if (type != InstrumentType::VST3) {
std::cerr << "[RenderJob] preset ignored for non-VST3 type " << (int)type
<< " (SF2/SFZ use soundfont_bank/soundfont_program)" << std::endl;
#ifdef HAVE_VST3SDK
} else if (!applyVst3Preset(mgr.get(0), preset)) {
fail("preset import FAILED for " + pluginPath);
return rc; // rc stays 1: job/argument error
} else {
std::cout << "[RenderJob] preset imported (VST3 .vstpreset) type=" << (int)type << std::endl;
}
#else
} else {
std::cerr << "[RenderJob] preset ignored: built without VST3 SDK" << std::endl;
}
#endif
}
// 6. Offline render loop — same dispatch/render split as the realtime
@@ -404,5 +406,4 @@ int run_render_job(const std::string& jobPath, const std::string& outPath) {
<< " samples, " << (dataBytes / 4) << " frames)" << std::endl;
rc = 0;
return rc;
#endif // HAVE_VST3SDK
}