native_bridge: recalibrate after preset restore, reject 3rd live VST2 instance
This commit is contained in:
@@ -276,6 +276,23 @@ bool InstrumentEngineManager::assign(uint32_t channel, InstrumentType type,
|
||||
return true;
|
||||
}
|
||||
|
||||
float InstrumentEngineManager::recalibrate(uint32_t channel, double sampleRate, uint32_t blockSize) {
|
||||
INativeInstrument* inst = nullptr;
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mu_);
|
||||
auto it = channels_.find(channel);
|
||||
if (it != channels_.end()) inst = it->second.get();
|
||||
}
|
||||
if (!inst) return 1.0f;
|
||||
// calibrate() probe-renders (up to ~0.9s) - never hold mu_ (audio stall).
|
||||
const float mk = calibrate(inst, sampleRate, blockSize);
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mu_);
|
||||
makeup_[channel] = mk;
|
||||
}
|
||||
return mk;
|
||||
}
|
||||
|
||||
void InstrumentEngineManager::unload(uint32_t channel) {
|
||||
if (channel >= 16) return;
|
||||
// Destructor runs on the CALLER thread (VST3 terminate must run on the
|
||||
|
||||
Reference in New Issue
Block a user