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_.
This commit is contained in:
2026-08-21 08:50:28 +07:00
parent b91e6d3875
commit a7b01d3484
7 changed files with 143 additions and 23 deletions
@@ -36,6 +36,10 @@ public:
// Headless engines (VST2 without an editor, SF2/SFZ): the bridge must
// not create/reuse a window for them.
virtual bool canOpenGUI() const { return true; }
// Sandbox hosts whose child owns its own top-level window (sandbox VST2):
// the bridge must not create a parent native window nor close other
// editors — attachView(nullptr) just forwards the OPEN_GUI control.
virtual bool ownsGuiWindow() const { return false; }
virtual void closeGUI() = 0;
// VST3 reopen-after-close: the bridge checks before openGUI whether the
// instance must be rebuilt; while it is, the engine sets reloading=true
@@ -177,6 +177,7 @@ private:
// Per-instrument scratch so engines that overwrite (not mix) stay additive.
std::vector<float> scratchL_, scratchR_;
// Channel-level reload flag (see isReloading) — indexed by MIDI channel.
bool calibratingCh_[16] = {}; // probe-render mute: renderAll skips channel during calibrate()
bool reloadingCh_[16] = {};
// G3.3: channel muted after a plugin fault inside processAudioBlock.
bool crashedCh_[16] = {};
@@ -188,4 +189,4 @@ private:
std::atomic<bool> isBypassed_{false};
};
#endif // NATIVE_INSTRUMENT_ENGINE_H
#endif // NATIVE_INSTRUMENT_ENGINE_H