// native_bridge/juce_fx/main_juce_fx.cpp // Entry point của juce_fx_bridge.exe — G1 POC: JUCE AudioProcessorGraph // thay RealtimeFxChain trong SHM realtime loop. Windows only. // --juce-fx --shm [--parent ] #include "JuceFxLoop.h" #ifdef _WIN32 #include #include #include #endif #include #include #include #ifdef _WIN32 static LONG WINAPI JuceCrashDumpHandler(EXCEPTION_POINTERS* ep) { static LONG once = 0; if (InterlockedCompareExchange(&once, 1, 0)) return EXCEPTION_CONTINUE_SEARCH; PEXCEPTION_RECORD er = ep ? ep->ExceptionRecord : nullptr; std::cerr << "[CRASH] juce_fx_bridge exception code=0x" << std::hex << (er ? er->ExceptionCode : 0) << " addr=0x" << (er ? (void*)er->ExceptionAddress : nullptr) << std::dec << std::endl; return EXCEPTION_CONTINUE_SEARCH; } #endif int main(int argc, char** argv) { #ifdef _WIN32 SetUnhandledExceptionFilter(JuceCrashDumpHandler); #endif std::string mode, jobPath, shmName; uint32_t parentPid = 0; for (int i = 1; i < argc; ++i) { const std::string a = argv[i]; if (a == "--juce-fx" && i + 1 < argc) { mode = a; jobPath = argv[++i]; } else if (a == "--shm" && i + 1 < argc) { shmName = argv[++i]; } else if (a == "--parent" && i + 1 < argc) { parentPid = (uint32_t)std::strtoul(argv[++i], nullptr, 10); } } if (mode != "--juce-fx" || jobPath.empty() || shmName.empty()) { std::cerr << "usage: juce_fx_bridge --juce-fx --shm " "[--parent ]" << std::endl; return 1; } return run_juce_fx_loop(jobPath, shmName, parentPid); }