From 0f6235c9b95f753e7f7f43284896511c48f9ae3b Mon Sep 17 00:00:00 2001 From: locphamtran Date: Fri, 21 Aug 2026 09:29:38 +0700 Subject: [PATCH] =?UTF-8?q?Fix=20Qin=20GUI=20n=E1=BB=81n=20tr=E1=BA=AFng?= =?UTF-8?q?=20khi=20m=E1=BB=9F=20l=E1=BA=A1i=20+=20MIDI=20keyboard=20previ?= =?UTF-8?q?ew=20trong=20GUI=20b=E1=BB=8B=20c=C3=A2m?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - plugin_host_main.cpp WM_CLOSE: destroy host window (sau effEditClose jBridge dialog cũ vẫn sống trong host; mở lại trên cùng window tạo jBridge dialog thứ 2 chồng lên -> nền trắng, editor không load). Mở lại tạo window mới sạch, đúng 1 jBridge dialog + Qin_VST_Window. - plugin_host_main.cpp: bỏ idle-skip khi editor đang attach — preview phím MIDI trong GUI là âm nội bộ plugin, không qua host MIDI; vòng loop idle không gọi processAudioBlock nên voice nội bộ không bao giờ render (câm). GUI mở -> render liên tục; GUI đóng vẫn idle như cũ. - Verify: mở/đóng/mở lại GUI ch1 -> host mới, đúng 1 editor, âm ch1 peak 0.13 (GUI mở) / 0.10 (sau đóng); bridgeWrite tăng liên tục khi GUI mở. --- native_bridge/src/plugin_host_main.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/native_bridge/src/plugin_host_main.cpp b/native_bridge/src/plugin_host_main.cpp index bf340ce..9c38f9c 100644 --- a/native_bridge/src/plugin_host_main.cpp +++ b/native_bridge/src/plugin_host_main.cpp @@ -55,8 +55,13 @@ static LRESULT CALLBACK PluginHostWndProc(HWND hwnd, UINT msg, WPARAM wParam, LP if (g_wndInst) { try { g_wndInst->closeGUI(); } catch (...) {} } - if (g_hostHwnd) ShowWindow(g_hostHwnd, SW_HIDE); - return 0; // swallow: do NOT let DefWindowProc destroy the window + // effEditClose leaves the jBridge wrapper dialog + stale editor + // children alive; re-opening on the SAME window stacks a second + // dialog on top -> white background, editor never loads. Destroy + // the window so the next OPEN_GUI creates a fresh one. + g_hostHwnd = nullptr; + DestroyWindow(hwnd); + return 0; // swallow: we destroyed it ourselves case WM_DESTROY: if (g_wndInst) { try { g_wndInst->closeGUI(); } catch (...) {} @@ -330,7 +335,7 @@ int main(int argc, char* argv[]) { printf("[plugin_host] parent gone - exiting\n"); break; } - if (idle) { + if (idle && !inst.hasAttachedView()) { // GUI preview needs continuous rendering Sleep(15); continue; }