Download Source/Helper/main.cpp from RAM2118/pluginbridge: direct link, hf CLI and curl.
- Browser
- Download file 3.29 kB
-
https://huggingface.co/RAM2118/pluginbridge/resolve/adbb96ae3e314faf8d615e79e689a764e6739111/Source/Helper/main.cpp
- Command line
-
hf download hf://RAM2118/pluginbridge@adbb96ae3e314faf8d615e79e689a764e6739111/Source/Helper/main.cpp
-
curl -L -o main.cpp https://huggingface.co/RAM2118/pluginbridge/resolve/adbb96ae3e314faf8d615e79e689a764e6739111/Source/Helper/main.cpp
3.29 kB
| // PluginBridgeHelper — standalone process that: | |
| // 1. Connects to parent via Unix socket | |
| // 2. Opens shared memory for audio | |
| // 3. Loads third-party plugins | |
| // 4. Runs processBlock when signaled | |
| // 5. Shows plugin GUI in its own window | |
| // 6. If it crashes, only this process dies — Ableton survives | |
| class HelperApplication : public juce::JUCEApplication | |
| { | |
| public: | |
| const juce::String getApplicationName() override { return "PluginBridgeHelper"; } | |
| const juce::String getApplicationVersion() override { return PluginBridgeConstants::kVersion; } | |
| void initialise(const juce::String& commandLine) override | |
| { | |
| // Parse args: --pid <parentPid> | |
| auto args = juce::StringArray::fromTokens(commandLine, " ", "\""); | |
| int parentPid = 0; | |
| for (int i = 0; i < args.size() - 1; ++i) | |
| { | |
| if (args[i] == "--pid") | |
| parentPid = args[i + 1].getIntValue(); | |
| } | |
| if (parentPid == 0) | |
| { | |
| DBG("HelperApplication: --pid argument required"); | |
| quit(); | |
| return; | |
| } | |
| DBG("HelperApplication: Starting for parent PID " + juce::String(parentPid)); | |
| // Initialize components | |
| pluginHost = std::make_unique<HelperPluginHost>(); | |
| ipcServer = std::make_unique<HelperIPC>(parentPid, *pluginHost); | |
| // Connect shared memory | |
| auto shmName = IPC::getShmName(parentPid); | |
| if (!sharedAudio.open(shmName)) | |
| { | |
| DBG("HelperApplication: Failed to open shared memory: " + shmName); | |
| quit(); | |
| return; | |
| } | |
| // Connect semaphores | |
| if (!inputSem.open(IPC::getInputSemName(parentPid)) || | |
| !outputSem.open(IPC::getOutputSemName(parentPid))) | |
| { | |
| DBG("HelperApplication: Failed to open semaphores"); | |
| quit(); | |
| return; | |
| } | |
| // Connect IPC socket | |
| if (!ipcServer->connect()) | |
| { | |
| DBG("HelperApplication: Failed to connect to parent IPC socket"); | |
| quit(); | |
| return; | |
| } | |
| // Give plugin host access to shared audio + semaphores | |
| pluginHost->setSharedAudio(&sharedAudio, &inputSem, &outputSem); | |
| // Start audio processing thread | |
| pluginHost->startProcessing(); | |
| // Notify parent we're ready | |
| ipcServer->sendReady(); | |
| DBG("HelperApplication: Ready and running"); | |
| } | |
| void shutdown() override | |
| { | |
| if (pluginHost) | |
| pluginHost->stopProcessing(); | |
| ipcServer.reset(); | |
| pluginHost.reset(); | |
| sharedAudio.destroy(); | |
| } | |
| void systemRequestedQuit() override | |
| { | |
| quit(); | |
| } | |
| private: | |
| std::unique_ptr<HelperPluginHost> pluginHost; | |
| std::unique_ptr<HelperIPC> ipcServer; | |
| SharedAudioBuffer sharedAudio; | |
| SharedSemaphore inputSem; | |
| SharedSemaphore outputSem; | |
| }; | |
| START_JUCE_APPLICATION(HelperApplication) | |