G1.4: bo mute-when-editor-open - channelQuiet chi con reloading; xoa editorOpen machinery (g_editorOpen/g_editorPathCount/clear_editor_open/setEditorOpenPredicate); audio loop process() binh thuong khi editor mo

This commit is contained in:
2026-08-15 21:28:16 +07:00
parent b92c85ec73
commit 7629783298
4 changed files with 1212 additions and 1282 deletions
+4 -16
View File
@@ -260,24 +260,12 @@ bool InstrumentEngineManager::isReloading(uint32_t channel) const {
return channel < 16 && reloadingCh_[channel];
}
void InstrumentEngineManager::setEditorOpenPredicate(std::function<bool(const std::string&)> fn) {
std::lock_guard<std::mutex> lock(mu_);
editorOpenFn_ = std::move(fn);
}
// Quiet = reloading OR an editor attached for the channel's plugin DLL path.
// Called with mu_ held by the real-time dispatch (the predicate locks
// g_editorMutex -- lock order mu_ -> g_editorMutex; g_editorMutex is never
// held while taking mu_).
// Quiet = reloading (mid-rebuild) only. G1.4: bo mute-when-editor-open —
// editor co the mo trong luc PLAY, audio loop van process() binh thuong.
// Called with mu_ held by the real-time dispatch.
bool InstrumentEngineManager::channelQuiet(uint32_t ch) const {
if (ch >= 16 || reloadingCh_[ch]) return true;
if (!editorOpenFn_) return false;
auto it = paths_.find(ch);
if (it == paths_.end() || it->second.empty()) return false;
std::string lp = it->second;
std::transform(lp.begin(), lp.end(), lp.begin(),
[](unsigned char c) { return (char)::tolower(c); });
return editorOpenFn_(lp);
return false;
}
// Real-time MIDI dispatch: hold mu_ for the WHOLE call so assign()/unload()