Fix: PluginBridgeProcessor.cpp use flat include for IPCProtocol.h (Source/Shared in include dirs)
Browse files1234564 unmodified lines1112131415161716 unmodified lines343536373839402 unmodified lines4344454647484917 unmodified lines676869707172733 unmodified lines77787980818283848586878889909192939495969798991001011021 unmodified line1041051061071081091101111121131146 unmodified lines12112212312412512612718 unmodified lines14614714814915015115216 unmodified lines1691701711721731741752 unmodified lines1781791801811821831841 unmodified line186187188189190191192#include "PluginBridgeProcessor.h"#include "PluginBridgeEditor.h"#include "../Shared/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 callbackhelper.onHelperCrashed = [this](){pluginLoaded = false;16 unmodified linescurrentSampleRate = sampleRate;currentBlockSize = samplesPerBlock;// If helper is connected, configure itif (helper.isHelperRunning()){json cmd = {{"cmd", "configure"},2 unmodified lines{"channels", 2}};helper.sendCommand(cmd.dump());// Update shared memory headerauto* header = helper.getSharedAudio().getHeader();if (header){17 unmodified linesfor (auto i = totalNumInputChannels; i < totalNumOutputChannels; ++i)buffer.clear(i, 0, buffer.getNumSamples());// If no plugin loaded or helper not running, pass throughif (!pluginLoaded || !helper.isHelperRunning())return;3 unmodified linesint numChannels = buffer.getNumChannels();int numSamples = buffer.getNumSamples();// Write input to shared memoryconst float* inputPtrs[2] = {buffer.getReadPointer(0),numChannels > 1 ? buffer.getReadPointer(1) : buffer.getReadPointer(0)};shm.writeInput(inputPtrs, numChannels, numSamples);// Update headerauto* header = shm.getHeader();header->blockSize.store((uint32_t)numSamples);header->numChannels.store((uint32_t)numChannels);header->state.store(kStateInputReady);// Signal helper: input is readyhelper.getInputSem().signal();// Wait for helper to finish processing (with timeout)if (helper.getOutputSem().wait(IPC::kProcessBlockTimeoutMs)){// Read output from shared memoryfloat* outputPtrs[2] = {buffer.getWritePointer(0),numChannels > 1 ? buffer.getWritePointer(1) : buffer.getWritePointer(0)1 unmodified lineshm.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 linesjuce::ValueTree state("PluginBridgeState");state.setProperty("pluginPath", pluginPath, nullptr);// Get plugin state from helperif (pluginLoaded && helper.isHelperRunning()){auto response = helper.sendCommand("{\"cmd\":\"get_state\"}");18 unmodified lines{loadPlugin(path);// Restore plugin state after loadingauto pluginState = state.getProperty("pluginState").toString();if (pluginState.isNotEmpty() && helper.isHelperRunning()){16 unmodified linesvoid PluginBridgeProcessor::loadPlugin(const juce::String& path){// Spawn helper if not runningif (!helper.isHelperRunning()){if (!helper.spawnHelper())2 unmodified linesreturn;}// Configure helper with current audio settingsjson configCmd = {{"cmd", "configure"},{"sampleRate", currentSampleRate},{"blockSize", currentBlockSize},1 unmodified linehelper.sendCommand(configCmd.dump());}// Send load commandjson loadCmd = {{"cmd", "load"},{"path", path.toStdString()},{"sampleRate", currentSampleRate},1234564 unmodified lines11121314151616 unmodified lines3334353637382 unmodified lines41424344454617 unmodified lines6465666768693 unmodified lines7374757677787980818283848586878889909192931 unmodified line95969798991006 unmodified lines10710810911011111218 unmodified lines13113213313413513616 unmodified lines1531541551561571582 unmodified lines1611621631641651661 unmodified line168169170171172173#include "PluginBridgeProcessor.h"#include "PluginBridgeEditor.h"#include "IPCProtocol.h"#include "json.hpp"using json = nlohmann::json;4 unmodified lines.withOutput("Output", juce::AudioChannelSet::stereo(), true)),mcpServer(PluginBridgeConstants::kDefaultMcpPort, helper){helper.onHelperCrashed = [this](){pluginLoaded = false;16 unmodified linescurrentSampleRate = sampleRate;currentBlockSize = samplesPerBlock;if (helper.isHelperRunning()){json cmd = {{"cmd", "configure"},2 unmodified lines{"channels", 2}};helper.sendCommand(cmd.dump());auto* header = helper.getSharedAudio().getHeader();if (header){17 unmodified linesfor (auto i = totalNumInputChannels; i < totalNumOutputChannels; ++i)buffer.clear(i, 0, buffer.getNumSamples());if (!pluginLoaded || !helper.isHelperRunning())return;3 unmodified linesint numChannels = buffer.getNumChannels();int numSamples = buffer.getNumSamples();const float* inputPtrs[2] = {buffer.getReadPointer(0),numChannels > 1 ? buffer.getReadPointer(1) : buffer.getReadPointer(0)};shm.writeInput(inputPtrs, numChannels, numSamples);auto* header = shm.getHeader();header->blockSize.store((uint32_t)numSamples);header->numChannels.store((uint32_t)numChannels);header->state.store(kStateInputReady);helper.getInputSem().signal();if (helper.getOutputSem().wait(IPC::kProcessBlockTimeoutMs)){float* outputPtrs[2] = {buffer.getWritePointer(0),numChannels > 1 ? buffer.getWritePointer(1) : buffer.getWritePointer(0)1 unmodified lineshm.readOutput(outputPtrs, numChannels, numSamples);header->state.store(kStateIdle);}}juce::AudioProcessorEditor* PluginBridgeProcessor::createEditor()6 unmodified linesjuce::ValueTree state("PluginBridgeState");state.setProperty("pluginPath", pluginPath, nullptr);if (pluginLoaded && helper.isHelperRunning()){auto response = helper.sendCommand("{\"cmd\":\"get_state\"}");18 unmodified lines{loadPlugin(path);auto pluginState = state.getProperty("pluginState").toString();if (pluginState.isNotEmpty() && helper.isHelperRunning()){16 unmodified linesvoid PluginBridgeProcessor::loadPlugin(const juce::String& path){if (!helper.isHelperRunning()){if (!helper.spawnHelper())2 unmodified linesreturn;}json configCmd = {{"cmd", "configure"},{"sampleRate", currentSampleRate},{"blockSize", currentBlockSize},1 unmodified linehelper.sendCommand(configCmd.dump());}json loadCmd = {{"cmd", "load"},{"path", path.toStdString()},{"sampleRate", currentSampleRate},
Source/Plugin/PluginBridgeProcessor.cpp+1-20