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
Binary file not shown.
@@ -110,7 +110,6 @@ public:
// plugin DLL path has an open editor count as quiet (same-plugin channels // plugin DLL path has an open editor count as quiet (same-plugin channels
// too -- the worker pumps the editor's window proc inside the DLL while the // too -- the worker pumps the editor's window proc inside the DLL while the
// audio loop process()es other instances of the same DLL). // audio loop process()es other instances of the same DLL).
void setEditorOpenPredicate(std::function<bool(const std::string& lowerPath)> fn);
// Flush every sounding note on every assigned channel. // Flush every sounding note on every assigned channel.
void allNotesOff(); void allNotesOff();
@@ -137,7 +136,6 @@ private:
// is in progress): real-time code drops MIDI and skips rendering. Lowercased // is in progress): real-time code drops MIDI and skips rendering. Lowercased
// compare inside -- Windows plugin paths are case-insensitive. // compare inside -- Windows plugin paths are case-insensitive.
bool channelQuiet(uint32_t ch) const; bool channelQuiet(uint32_t ch) const;
std::function<bool(const std::string&)> editorOpenFn_;
std::atomic<bool> isBypassed_{false}; std::atomic<bool> isBypassed_{false};
}; };
+4 -16
View File
@@ -260,24 +260,12 @@ bool InstrumentEngineManager::isReloading(uint32_t channel) const {
return channel < 16 && reloadingCh_[channel]; return channel < 16 && reloadingCh_[channel];
} }
void InstrumentEngineManager::setEditorOpenPredicate(std::function<bool(const std::string&)> fn) { // Quiet = reloading (mid-rebuild) only. G1.4: bo mute-when-editor-open —
std::lock_guard<std::mutex> lock(mu_); // editor co the mo trong luc PLAY, audio loop van process() binh thuong.
editorOpenFn_ = std::move(fn); // Called with mu_ held by the real-time dispatch.
}
// 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_).
bool InstrumentEngineManager::channelQuiet(uint32_t ch) const { bool InstrumentEngineManager::channelQuiet(uint32_t ch) const {
if (ch >= 16 || reloadingCh_[ch]) return true; if (ch >= 16 || reloadingCh_[ch]) return true;
if (!editorOpenFn_) return false; 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);
} }
// Real-time MIDI dispatch: hold mu_ for the WHOLE call so assign()/unload() // Real-time MIDI dispatch: hold mu_ for the WHOLE call so assign()/unload()
+1208 -1264
View File
File diff suppressed because it is too large Load Diff