Fix: PluginBridgeProcessor.cpp use flat include for IPCProtocol.h (Source/Shared in include dirs)
Browse files12334564 unmodified lines1112131414151616 unmodified lines333435373637382 unmodified lines4142434644454617 unmodified lines646566706768693 unmodified lines73747580767778798081878283848586938788968990999192931 unmodified line95969710710810911011198991006 unmodified lines10710810912411011111218 unmodified lines13113213314913413513616 unmodified lines1531541551721561571582 unmodified lines1611621631811641651661 unmodified line168169170189171172173#include "PluginBridgeProcessor.h"#include "PluginBridgeEditor.h"#include "../Shared/IPCProtocol.h"#include "IPCProtocol.h"
#include "json.hpp"using json = nlohmann::json;4 unmodified lines .withOutput("Output", juce::AudioChannelSet::stereo(), true)), mcpServer(PluginBridgeConstants::kDefaultMcpPort, helper){ // Set up crash callback helper.onHelperCrashed = [this]() { pluginLoaded = false;16 unmodified lines currentSampleRate = sampleRate; currentBlockSize = samplesPerBlock;
// If helper is connected, configure it if (helper.isHelperRunning()) { json cmd = {{"cmd", "configure"},2 unmodified lines {"channels", 2}}; helper.sendCommand(cmd.dump());
// Update shared memory header auto* header = helper.getSharedAudio().getHeader(); if (header) {17 unmodified lines for (auto i = totalNumInputChannels; i < totalNumOutputChannels; ++i) buffer.clear(i, 0, buffer.getNumSamples());
// If no plugin loaded or helper not running, pass through if (!pluginLoaded || !helper.isHelperRunning()) return;
3 unmodified lines int numChannels = buffer.getNumChannels(); int numSamples = buffer.getNumSamples();
// Write input to shared memory const float* inputPtrs[2] = { buffer.getReadPointer(0), numChannels > 1 ? buffer.getReadPointer(1) : buffer.getReadPointer(0) }; shm.writeInput(inputPtrs, numChannels, numSamples);
// Update header auto* header = shm.getHeader(); header->blockSize.store((uint32_t)numSamples); header->numChannels.store((uint32_t)numChannels); header->state.store(kStateInputReady);
// Signal helper: input is ready helper.getInputSem().signal();
// Wait for helper to finish processing (with timeout) if (helper.getOutputSem().wait(IPC::kProcessBlockTimeoutMs)) { // Read output from shared memory float* outputPtrs[2] = { buffer.getWritePointer(0), numChannels > 1 ? buffer.getWritePointer(1) : buffer.getWritePointer(0)1 unmodified line shm.readOutput(outputPtrs, numChannels, numSamples); header->state.store(kStateIdle); } else { // Timeout — helper might be stuck or crashed. Pass through silence. // (Don't pass through input — if plugin was supposed to process, silence is safer) }}
juce::AudioProcessorEditor* PluginBridgeProcessor::createEditor()6 unmodified lines juce::ValueTree state("PluginBridgeState"); state.setProperty("pluginPath", pluginPath, nullptr);
// Get plugin state from helper if (pluginLoaded && helper.isHelperRunning()) { auto response = helper.sendCommand("{\"cmd\":\"get_state\"}");18 unmodified lines { loadPlugin(path);
// Restore plugin state after loading auto pluginState = state.getProperty("pluginState").toString(); if (pluginState.isNotEmpty() && helper.isHelperRunning()) {16 unmodified lines
void PluginBridgeProcessor::loadPlugin(const juce::String& path){ // Spawn helper if not running if (!helper.isHelperRunning()) { if (!helper.spawnHelper())2 unmodified lines return; }
// Configure helper with current audio settings json configCmd = {{"cmd", "configure"}, {"sampleRate", currentSampleRate}, {"blockSize", currentBlockSize},1 unmodified line helper.sendCommand(configCmd.dump()); }
// Send load command json loadCmd = {{"cmd", "load"}, {"path", path.toStdString()}, {"sampleRate", currentSampleRate},Source/Plugin/PluginBridgeProcessor.cpp+1-20