wire AudioAnalyser: prepareToPlay + processBlock + MCP callback (3 additions)
Browse files
Source/Plugin/PluginBridgeProcessor.cpp
CHANGED
|
@@ -22,7 +22,6 @@ PluginBridgeProcessor::PluginBridgeProcessor()
|
|
| 22 |
DBG("PluginBridgeProcessor: Helper crashed");
|
| 23 |
};
|
| 24 |
|
| 25 |
-
// When helper sends "ready" notification with layer port info
|
| 26 |
helper.onGuiReady = [this](const juce::String& portName, int width, int height)
|
| 27 |
{
|
| 28 |
remoteLayerPortName = portName;
|
|
@@ -40,6 +39,9 @@ PluginBridgeProcessor::PluginBridgeProcessor()
|
|
| 40 |
juce::MessageManager::callAsync([this, width, height]() { if (onGuiResized) onGuiResized(width, height); });
|
| 41 |
};
|
| 42 |
|
|
|
|
|
|
|
|
|
|
| 43 |
mcpServer->start();
|
| 44 |
}
|
| 45 |
|
|
@@ -54,6 +56,9 @@ void PluginBridgeProcessor::prepareToPlay(double sampleRate, int samplesPerBlock
|
|
| 54 |
currentSampleRate = sampleRate;
|
| 55 |
currentBlockSize = samplesPerBlock;
|
| 56 |
|
|
|
|
|
|
|
|
|
|
| 57 |
if (helper.isHelperRunning())
|
| 58 |
{
|
| 59 |
json cmd = {{"cmd", "configure"},
|
|
@@ -113,6 +118,9 @@ void PluginBridgeProcessor::processBlock(juce::AudioBuffer<float>& buffer, juce:
|
|
| 113 |
};
|
| 114 |
shm.readOutput(outputPtrs, numChannels, numSamples);
|
| 115 |
header->state.store(kStateIdle);
|
|
|
|
|
|
|
|
|
|
| 116 |
}
|
| 117 |
}
|
| 118 |
|
|
@@ -174,7 +182,6 @@ void PluginBridgeProcessor::loadPlugin(const juce::String& path)
|
|
| 174 |
{
|
| 175 |
pluginLoaded = false;
|
| 176 |
auto error = juce::String(j.value("error", "unknown"));
|
| 177 |
-
// If plugin failed in helper, blocklist it
|
| 178 |
blocklist.addBlocked(path);
|
| 179 |
if (onLoadFailed)
|
| 180 |
onLoadFailed("Not compatible: " + error);
|
|
|
|
| 22 |
DBG("PluginBridgeProcessor: Helper crashed");
|
| 23 |
};
|
| 24 |
|
|
|
|
| 25 |
helper.onGuiReady = [this](const juce::String& portName, int width, int height)
|
| 26 |
{
|
| 27 |
remoteLayerPortName = portName;
|
|
|
|
| 39 |
juce::MessageManager::callAsync([this, width, height]() { if (onGuiResized) onGuiResized(width, height); });
|
| 40 |
};
|
| 41 |
|
| 42 |
+
// Wire audio analysis to MCP get_analysis tool
|
| 43 |
+
mcpServer->getAnalysisCallback = [this]() { return analyser.getCompactAnalysis(); };
|
| 44 |
+
|
| 45 |
mcpServer->start();
|
| 46 |
}
|
| 47 |
|
|
|
|
| 56 |
currentSampleRate = sampleRate;
|
| 57 |
currentBlockSize = samplesPerBlock;
|
| 58 |
|
| 59 |
+
// Prepare audio analyser
|
| 60 |
+
analyser.prepareToPlay(sampleRate, samplesPerBlock);
|
| 61 |
+
|
| 62 |
if (helper.isHelperRunning())
|
| 63 |
{
|
| 64 |
json cmd = {{"cmd", "configure"},
|
|
|
|
| 118 |
};
|
| 119 |
shm.readOutput(outputPtrs, numChannels, numSamples);
|
| 120 |
header->state.store(kStateIdle);
|
| 121 |
+
|
| 122 |
+
// Analyse the output audio (post-plugin processing)
|
| 123 |
+
analyser.processBlock(buffer);
|
| 124 |
}
|
| 125 |
}
|
| 126 |
|
|
|
|
| 182 |
{
|
| 183 |
pluginLoaded = false;
|
| 184 |
auto error = juce::String(j.value("error", "unknown"));
|
|
|
|
| 185 |
blocklist.addBlocked(path);
|
| 186 |
if (onLoadFailed)
|
| 187 |
onLoadFailed("Not compatible: " + error);
|