wip walkthrough 2 bridge: jobEvent_/MsgWaitForMultipleObjects pump, SetThreadPriority + PowerThrottling, isBypassed silence quanh assign/unload, closeGUI view->removed(), reloadForGUI reuse instance, bo mute khi GUI mo, CoInitializeEx MTA — CHƯA verified: driver test 1/3 PASS (AV c0000005 Nexus!GetPluginFactory luc attachView ch5, nghi MTA/bo mute), exe deploy giu ban 0cec3d3 (28104a47)
This commit is contained in:
@@ -13,6 +13,8 @@
|
||||
#include <cctype>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// 1. SOUNDFONT ENGINE (.SF2 / .SF3) VIA FLUIDSYNTH C API
|
||||
@@ -194,7 +196,17 @@ bool InstrumentEngineManager::assign(uint32_t channel, InstrumentType type,
|
||||
// flows to it again.
|
||||
reloadingCh_[channel] = false;
|
||||
}
|
||||
oldInst.reset();
|
||||
if (oldInst) {
|
||||
isBypassed_.store(true);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
try {
|
||||
oldInst.reset();
|
||||
} catch (...) {
|
||||
isBypassed_.store(false);
|
||||
throw;
|
||||
}
|
||||
isBypassed_.store(false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -211,7 +223,17 @@ void InstrumentEngineManager::unload(uint32_t channel) {
|
||||
paths_.erase(channel);
|
||||
reloadingCh_[channel] = false;
|
||||
}
|
||||
oldInst.reset();
|
||||
if (oldInst) {
|
||||
isBypassed_.store(true);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
try {
|
||||
oldInst.reset();
|
||||
} catch (...) {
|
||||
isBypassed_.store(false);
|
||||
throw;
|
||||
}
|
||||
isBypassed_.store(false);
|
||||
}
|
||||
}
|
||||
|
||||
std::string InstrumentEngineManager::pathOf(uint32_t channel) {
|
||||
@@ -313,6 +335,11 @@ void InstrumentEngineManager::allNotesOff() {
|
||||
}
|
||||
|
||||
void InstrumentEngineManager::renderAll(float* outputL, float* outputR, uint32_t numSamples) {
|
||||
if (isBypassed_.load()) {
|
||||
std::memset(outputL, 0, numSamples * sizeof(float));
|
||||
std::memset(outputR, 0, numSamples * sizeof(float));
|
||||
return;
|
||||
}
|
||||
std::lock_guard<std::mutex> lock(mu_);
|
||||
std::memset(outputL, 0, numSamples * sizeof(float));
|
||||
std::memset(outputR, 0, numSamples * sizeof(float));
|
||||
|
||||
Reference in New Issue
Block a user