Sprint 1: Add PluginBridgeProcessor.cpp — audio passthrough + MCP server lifecycle
Browse files
Source/PluginBridgeProcessor.cpp
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#include "PluginBridgeProcessor.h"
|
| 2 |
+
#include "PluginBridgeEditor.h"
|
| 3 |
+
|
| 4 |
+
PluginBridgeProcessor::PluginBridgeProcessor()
|
| 5 |
+
: AudioProcessor(BusesProperties()
|
| 6 |
+
.withInput("Input", juce::AudioChannelSet::stereo(), true)
|
| 7 |
+
.withOutput("Output", juce::AudioChannelSet::stereo(), true)),
|
| 8 |
+
mcpServer(kDefaultMcpPort)
|
| 9 |
+
{
|
| 10 |
+
// Start MCP server in background thread
|
| 11 |
+
mcpServer.start();
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
PluginBridgeProcessor::~PluginBridgeProcessor()
|
| 15 |
+
{
|
| 16 |
+
mcpServer.stop();
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
void PluginBridgeProcessor::prepareToPlay(double /*sampleRate*/, int /*samplesPerBlock*/)
|
| 20 |
+
{
|
| 21 |
+
// Phase 2: prepare hosted plugin + analyser here
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
void PluginBridgeProcessor::releaseResources()
|
| 25 |
+
{
|
| 26 |
+
// Phase 2: release hosted plugin + analyser here
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
void PluginBridgeProcessor::processBlock(juce::AudioBuffer<float>& buffer,
|
| 30 |
+
juce::MidiBuffer& /*midiMessages*/)
|
| 31 |
+
{
|
| 32 |
+
juce::ScopedNoDenormals noDenormals;
|
| 33 |
+
|
| 34 |
+
// Clear any extra output channels
|
| 35 |
+
auto totalNumInputChannels = getTotalNumInputChannels();
|
| 36 |
+
auto totalNumOutputChannels = getTotalNumOutputChannels();
|
| 37 |
+
for (auto i = totalNumInputChannels; i < totalNumOutputChannels; ++i)
|
| 38 |
+
buffer.clear(i, 0, buffer.getNumSamples());
|
| 39 |
+
|
| 40 |
+
// Sprint 1: Pure passthrough — audio goes in, audio goes out unchanged
|
| 41 |
+
// Phase 2: analyser.processBlock(buffer)
|
| 42 |
+
// Phase 2: hostedPlugin->processBlock(buffer, midi)
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
juce::AudioProcessorEditor* PluginBridgeProcessor::createEditor()
|
| 46 |
+
{
|
| 47 |
+
return new PluginBridgeEditor(*this);
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
void PluginBridgeProcessor::getStateInformation(juce::MemoryBlock& /*destData*/)
|
| 51 |
+
{
|
| 52 |
+
// Phase 2: save which plugin is loaded + its state
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
void PluginBridgeProcessor::setStateInformation(const void* /*data*/, int /*sizeInBytes*/)
|
| 56 |
+
{
|
| 57 |
+
// Phase 2: restore hosted plugin from saved state
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
bool PluginBridgeProcessor::isMcpServerRunning() const
|
| 61 |
+
{
|
| 62 |
+
return mcpServer.isRunning();
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
int PluginBridgeProcessor::getMcpServerPort() const
|
| 66 |
+
{
|
| 67 |
+
return mcpServer.getPort();
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
// JUCE plugin entry point
|
| 71 |
+
juce::AudioProcessor* JUCE_CALLTYPE createPluginFilter()
|
| 72 |
+
{
|
| 73 |
+
return new PluginBridgeProcessor();
|
| 74 |
+
}
|