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)

This commit is contained in:
2026-08-18 16:56:05 +07:00
parent cbcc1f658c
commit 351ee56080
11 changed files with 2234 additions and 2019 deletions
@@ -156,17 +156,22 @@ public:
private:
static std::unique_ptr<INativeInstrument> create_instrument(InstrumentType type);
// Probe-render 3 notes sau khi load, do peak, tinh makeup de note don ra
// ~ -6 dBFS (0.5) - can bang am luong moi engine (VST2/VST3/SF2/SFZ).
static float calibrate(INativeInstrument* inst, double sampleRate, uint32_t blockSize);
mutable std::mutex mu_;
std::map<uint32_t, std::unique_ptr<INativeInstrument>> channels_;
std::map<uint32_t, std::string> paths_; // last assigned path per channel
std::map<uint32_t, InstrumentType> types_; // last assigned type per channel (G2.1)
std::map<uint32_t, float> makeup_; // calibrated per-channel output gain (renderAll ap dung)
// 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 reloadingCh_[16] = {};
// G3.3: channel muted after a plugin fault inside processAudioBlock.
bool crashedCh_[16] = {};
float limiterGain_ = 1.0f; // smoothed mix limiter state (renderAll)
// True when the channel's plugin DLL has an attached editor (or its reload
// is in progress): real-time code drops MIDI and skips rendering. Lowercased
// compare inside -- Windows plugin paths are case-insensitive.