diff --git a/native_bridge/src/main.cpp b/native_bridge/src/main.cpp index b0e3713..20e51ae 100644 --- a/native_bridge/src/main.cpp +++ b/native_bridge/src/main.cpp @@ -724,6 +724,48 @@ int main(int argc, char* argv[]) { // stderr, not stdout: stdout is reserved for machine-readable output in // one-shot modes (--scan JSON, --fx-gui "SF_FXGUI_PORT=..."). std::cerr << "[NativeBridge] Starting DAW Host Bridge Engine..." << std::endl; + + // JBridge per-plugin settings bootstrap: Kong Audio Qin bridges all + // instances through a SHARED auxhost.exe unless the per-plugin settings + // file disables "run in existing auxhost"; the shared auxhost then caps + // at 2 live instances (3rd floods ML_RELEASE_ERROR forever). Writing + // RUN_IN_EXISTING_AUXHOST 0 gives every instance its own auxhost -> + // unlimited Qin tracks. File is created if missing, never overwritten + // (user tweaks are respected). + try { + const char* appdata = std::getenv("APPDATA"); + if (appdata) { + const char* dirs[] = {"SettingsFilesFor64BitPlugins", "SettingsFilesFor32BitPlugins"}; + for (const char* d : dirs) { + std::string dir = std::string(appdata) + "\\jBridge\\" + d; + std::string file = dir + "\\Qin_RV.jBridge"; + CreateDirectoryA(dir.c_str(), nullptr); + HANDLE h = CreateFileA(file.c_str(), GENERIC_READ, FILE_SHARE_READ, nullptr, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); + if (h == INVALID_HANDLE_VALUE) { + const char* content = + "//Qin_RV.jBridge - jBridge per-plugin settings\r\n" + "RUN_IN_EXISTING_AUXHOST 0\r\n" + "RUN_IN_SAME_AUXHOST_GROUP 0\r\n" + "AUXHOST_PRIORITY 0\r\n" + "USE_SEPARATED_GUI 0\r\n" + "USE_DEPRECATED_OPCODES 0\r\n"; + HANDLE w = CreateFileA(file.c_str(), GENERIC_WRITE, 0, nullptr, + CREATE_NEW, FILE_ATTRIBUTE_NORMAL, nullptr); + if (w != INVALID_HANDLE_VALUE) { + DWORD wr = 0; + WriteFile(w, content, (DWORD)strlen(content), &wr, nullptr); + CloseHandle(w); + std::cerr << "[NativeBridge] jBridge settings created: " << file << std::endl; + } + } else { + CloseHandle(h); + } + } + } + } catch (...) { + std::cerr << "[NativeBridge] jBridge settings bootstrap failed (non-fatal)" << std::endl; + } #ifdef _WIN32 // Disable Power Throttling (Efficiency Mode) for this background process #ifndef PROCESS_POWER_THROTTLING_IGNORE_TIMER_RESOLUTION