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