Upload Source/Plugin/PluginBridgeProcessor.h
Browse files
Source/Plugin/PluginBridgeProcessor.h
CHANGED
|
@@ -2,11 +2,11 @@
|
|
| 2 |
|
| 3 |
#include <juce_audio_processors/juce_audio_processors.h>
|
| 4 |
#include <juce_dsp/juce_dsp.h>
|
|
|
|
|
|
|
| 5 |
#include "Blocklist.h"
|
| 6 |
#include "Constants.h"
|
| 7 |
|
| 8 |
-
class McpServer;
|
| 9 |
-
|
| 10 |
class PluginBridgeProcessor : public juce::AudioProcessor
|
| 11 |
{
|
| 12 |
public:
|
|
@@ -37,13 +37,18 @@ public:
|
|
| 37 |
// MCP
|
| 38 |
bool isMcpServerRunning() const;
|
| 39 |
int getMcpServerPort() const;
|
|
|
|
| 40 |
|
| 41 |
-
// Plugin
|
| 42 |
-
void loadPlugin(const juce::String&
|
| 43 |
void unloadPlugin();
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
juce::String getLastPluginPath() const { return pluginPath; }
|
| 48 |
|
| 49 |
// Plugin list
|
|
@@ -53,44 +58,33 @@ public:
|
|
| 53 |
bool isBlocked(const juce::String& path) const;
|
| 54 |
Blocklist& getBlocklist() { return blocklist; }
|
| 55 |
|
| 56 |
-
//
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
int index;
|
| 63 |
-
juce::String id;
|
| 64 |
-
juce::String name;
|
| 65 |
-
float value;
|
| 66 |
-
juce::String displayText;
|
| 67 |
-
};
|
| 68 |
-
std::vector<ParamInfo> searchParams(const juce::String& keyword) const;
|
| 69 |
-
std::vector<std::pair<int, float>> getParams(const std::vector<int>& ids) const;
|
| 70 |
-
bool setParams(const std::map<int, float>& values);
|
| 71 |
-
|
| 72 |
-
// For editor: get hosted plugin's editor component
|
| 73 |
-
juce::AudioProcessorEditor* createHostedPluginEditor();
|
| 74 |
-
|
| 75 |
-
// Notify editor that plugin changed
|
| 76 |
std::function<void()> onPluginLoaded;
|
| 77 |
std::function<void()> onPluginUnloaded;
|
|
|
|
|
|
|
| 78 |
std::function<void(const juce::String&)> onLoadFailed;
|
| 79 |
|
| 80 |
private:
|
| 81 |
-
|
| 82 |
-
juce::AudioPluginFormatManager formatManager;
|
| 83 |
-
std::unique_ptr<juce::AudioPluginInstance> hostedPlugin;
|
| 84 |
-
juce::CriticalSection pluginLock;
|
| 85 |
-
|
| 86 |
-
// MCP server
|
| 87 |
std::unique_ptr<McpServer> mcpServer;
|
| 88 |
-
|
| 89 |
-
// Blocklist (persisted to disk)
|
| 90 |
Blocklist blocklist;
|
| 91 |
|
| 92 |
-
|
|
|
|
| 93 |
juce::String pluginPath;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
double currentSampleRate = 44100.0;
|
| 95 |
int currentBlockSize = 512;
|
| 96 |
|
|
|
|
| 2 |
|
| 3 |
#include <juce_audio_processors/juce_audio_processors.h>
|
| 4 |
#include <juce_dsp/juce_dsp.h>
|
| 5 |
+
#include "HelperConnection.h"
|
| 6 |
+
#include "McpServer.h"
|
| 7 |
#include "Blocklist.h"
|
| 8 |
#include "Constants.h"
|
| 9 |
|
|
|
|
|
|
|
| 10 |
class PluginBridgeProcessor : public juce::AudioProcessor
|
| 11 |
{
|
| 12 |
public:
|
|
|
|
| 37 |
// MCP
|
| 38 |
bool isMcpServerRunning() const;
|
| 39 |
int getMcpServerPort() const;
|
| 40 |
+
HelperConnection& getHelperConnection() { return helper; }
|
| 41 |
|
| 42 |
+
// Plugin lifecycle (via Helper)
|
| 43 |
+
void loadPlugin(const juce::String& pluginPath);
|
| 44 |
void unloadPlugin();
|
| 45 |
+
void showPluginGui();
|
| 46 |
+
void hidePluginGui();
|
| 47 |
+
|
| 48 |
+
bool isPluginLoaded() const { return pluginLoaded; }
|
| 49 |
+
juce::String getLoadedPluginName() const { return pluginName; }
|
| 50 |
+
int getLoadedPluginParamCount() const { return pluginParamCount; }
|
| 51 |
+
HelperConnection::State getConnectionState() const { return helper.getState(); }
|
| 52 |
juce::String getLastPluginPath() const { return pluginPath; }
|
| 53 |
|
| 54 |
// Plugin list
|
|
|
|
| 58 |
bool isBlocked(const juce::String& path) const;
|
| 59 |
Blocklist& getBlocklist() { return blocklist; }
|
| 60 |
|
| 61 |
+
// Remote GUI info (from Helper via IPC)
|
| 62 |
+
juce::String getRemoteLayerPortName() const { return remoteLayerPortName; }
|
| 63 |
+
int getRemoteGuiWidth() const { return remoteGuiWidth; }
|
| 64 |
+
int getRemoteGuiHeight() const { return remoteGuiHeight; }
|
| 65 |
+
|
| 66 |
+
// Callbacks for editor
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
std::function<void()> onPluginLoaded;
|
| 68 |
std::function<void()> onPluginUnloaded;
|
| 69 |
+
std::function<void()> onGuiReady; // remote layer port available
|
| 70 |
+
std::function<void(int, int)> onGuiResized;
|
| 71 |
std::function<void(const juce::String&)> onLoadFailed;
|
| 72 |
|
| 73 |
private:
|
| 74 |
+
HelperConnection helper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
std::unique_ptr<McpServer> mcpServer;
|
|
|
|
|
|
|
| 76 |
Blocklist blocklist;
|
| 77 |
|
| 78 |
+
bool pluginLoaded = false;
|
| 79 |
+
juce::String pluginName;
|
| 80 |
juce::String pluginPath;
|
| 81 |
+
int pluginParamCount = 0;
|
| 82 |
+
|
| 83 |
+
// Remote GUI state
|
| 84 |
+
juce::String remoteLayerPortName;
|
| 85 |
+
int remoteGuiWidth = 0;
|
| 86 |
+
int remoteGuiHeight = 0;
|
| 87 |
+
|
| 88 |
double currentSampleRate = 44100.0;
|
| 89 |
int currentBlockSize = 512;
|
| 90 |
|