Download Source/Plugin/HelperConnection.h from RAM2118/pluginbridge: direct link, hf CLI and curl.
- Browser
- Download file 1.84 kB
-
https://huggingface.co/RAM2118/pluginbridge/resolve/fdc4e418d34e7f32ef31422f1e9aae1de08f4e86/Source/Plugin/HelperConnection.h
- Command line
-
hf download hf://RAM2118/pluginbridge@fdc4e418d34e7f32ef31422f1e9aae1de08f4e86/Source/Plugin/HelperConnection.h
-
curl -L -o HelperConnection.h https://huggingface.co/RAM2118/pluginbridge/resolve/fdc4e418d34e7f32ef31422f1e9aae1de08f4e86/Source/Plugin/HelperConnection.h
1.84 kB
| class HelperConnection : private juce::Timer | |
| { | |
| public: | |
| HelperConnection(); | |
| ~HelperConnection(); | |
| // Lifecycle | |
| bool spawnHelper(); | |
| void killHelper(); | |
| bool isHelperRunning() const { return helperRunning.load(); } | |
| // Audio bridge | |
| SharedAudioBuffer& getSharedAudio() { return sharedAudio; } | |
| SharedSemaphore& getInputSem() { return inputSem; } | |
| SharedSemaphore& getOutputSem() { return outputSem; } | |
| // Send commands (blocking — waits for response) | |
| std::string sendCommand(const std::string& json); | |
| // State | |
| enum class State { Disconnected, Starting, Connected, Crashed }; | |
| State getState() const { return state.load(); } | |
| // Callbacks | |
| std::function<void()> onHelperReady; | |
| std::function<void()> onHelperCrashed; | |
| std::function<void(int, float)> onParamChanged; | |
| std::function<void(const juce::String&, int, int)> onGuiReady; // portName, width, height | |
| std::function<void(int, int)> onGuiResized; // width, height | |
| private: | |
| void timerCallback() override; | |
| void ipcListenLoop(); | |
| void handleNotification(const std::string& json); | |
| pid_t helperPid = 0; | |
| std::atomic<bool> helperRunning{false}; | |
| std::atomic<State> state{State::Disconnected}; | |
| SharedAudioBuffer sharedAudio; | |
| SharedSemaphore inputSem; | |
| SharedSemaphore outputSem; | |
| int serverSocketFd = -1; | |
| int clientSocketFd = -1; | |
| std::thread ipcThread; | |
| std::atomic<bool> ipcRunning{false}; | |
| std::mutex commandMutex; | |
| std::string lastResponse; | |
| std::atomic<bool> responseReady{false}; | |
| int myPid; | |
| }; | |