G0.4: save/restore preset quanh reload khi close GUI (captureState/restoreState, memorystream link truc tiep)

This commit is contained in:
2026-08-15 20:04:56 +07:00
parent 5313d85926
commit eac7f2feb8
6 changed files with 77 additions and 1 deletions
+5
View File
@@ -707,7 +707,12 @@ static void post_close_gui(uint32_t ch, HWND hwnd) {
// load/assign rebuilds it).
std::lock_guard<std::mutex> lg(g_loadMutex);
try {
// G0.4: reload() terminates + recreates the instance;
// capture the preset first, restore it after, so the
// sound survives a GUI close (reopen keeps it too).
i->captureState();
i->reload();
i->restoreState();
} catch (...) {
std::cerr << "[NativeBridge] closeGUI reload EXCEPTION ch=" << ch
<< " — plugin threw (createInstance)" << std::endl;