RAM2118 commited on
Commit
0a63fb2
·
verified ·
1 Parent(s): 351c5a1

Sprint 6: add channelName + setChannelName to Processor header

Browse files
Files changed (1) hide show
  1. Source/Plugin/PluginBridgeProcessor.h +14 -13
Source/Plugin/PluginBridgeProcessor.h CHANGED
@@ -7,6 +7,7 @@
7
  #include "Blocklist.h"
8
  #include "PluginSafetyDB.h"
9
  #include "AudioAnalyser.h"
 
10
  #include "Constants.h"
11
  #include <map>
12
  #include <mutex>
@@ -45,6 +46,10 @@ public:
45
  int getMcpServerPort() const;
46
  HelperConnection& getHelperConnection() { return helper; }
47
 
 
 
 
 
48
  // Plugin lifecycle
49
  void loadPlugin(const juce::String& pluginPath);
50
  void unloadPlugin();
@@ -55,14 +60,13 @@ public:
55
  HelperConnection::State getConnectionState() const { return helper.getState(); }
56
  juce::String getLastPluginPath() const { return pluginPath; }
57
 
58
- // In-process plugin instance (GUI only — null when plugin is unsafe)
59
  juce::AudioPluginInstance* getInProcessPlugin() const { return inProcessPlugin.get(); }
60
 
61
  // Plugin list
62
  juce::Array<juce::File> getInstalledPluginFiles() const;
63
 
64
- // Manufacturer name for a plugin file (reads moduleinfo.json for VST3, heuristic for AU)
65
- // Fast — no plugin loading. Results cached in memory.
66
  juce::String getPluginManufacturer(const juce::File& pluginFile) const;
67
 
68
  // Blocklist
@@ -74,25 +78,21 @@ public:
74
  void startBackgroundScan();
75
  void stopBackgroundScan();
76
 
77
- // Audio analysis (for MCP get_analysis)
78
  std::string getAnalysis() const { return analyser.getCompactAnalysis(); }
79
 
80
  // Callbacks for editor
81
- std::function<void()> onPluginWillLoad; // fired BEFORE old plugin/editor torn down
82
  std::function<void()> onPluginLoaded;
83
  std::function<void()> onPluginUnloaded;
84
  std::function<void(const juce::String&)> onLoadFailed;
85
- std::function<void(const juce::String&, bool)> onScanProgress; // path, safe
86
 
87
  private:
88
  void loadInProcessPlugin(const juce::String& path);
89
  void unloadInProcessPlugin();
90
-
91
- // Spawns Helper with --scan <path>, waits up to 10s, returns true if safe.
92
- // Safe to call from any thread. Never crashes Ableton on plugin crash.
93
  bool runPluginScan(const juce::String& path);
94
 
95
- // AudioProcessorListener — forwards in-process param changes to Helper
96
  void audioProcessorParameterChanged(juce::AudioProcessor*, int paramIdx, float value) override;
97
  void audioProcessorChanged(juce::AudioProcessor*, const ChangeDetails&) override {}
98
 
@@ -102,7 +102,7 @@ private:
102
  PluginSafetyDB safetyDB;
103
  AudioAnalyser analyser;
104
 
105
- // In-process plugin (GUI instance — nullptr for unsafe plugins)
106
  juce::AudioPluginFormatManager inProcessFormatManager;
107
  std::unique_ptr<juce::AudioPluginInstance> inProcessPlugin;
108
  std::atomic<bool> suppressParamSync{false};
@@ -112,14 +112,15 @@ private:
112
  juce::String pluginPath;
113
  int pluginParamCount = 0;
114
 
 
 
 
115
  double currentSampleRate = 44100.0;
116
  int currentBlockSize = 512;
117
 
118
- // Background scanner
119
  std::thread scanThread;
120
  std::atomic<bool> scanRunning{false};
121
 
122
- // Manufacturer name cache (path → manufacturer)
123
  mutable std::map<std::string, std::string> manufacturerCache;
124
  mutable std::mutex manufacturerCacheMutex;
125
 
 
7
  #include "Blocklist.h"
8
  #include "PluginSafetyDB.h"
9
  #include "AudioAnalyser.h"
10
+ #include "InstanceRegistry.h"
11
  #include "Constants.h"
12
  #include <map>
13
  #include <mutex>
 
46
  int getMcpServerPort() const;
47
  HelperConnection& getHelperConnection() { return helper; }
48
 
49
+ // Channel name (for multi-instance identification)
50
+ void setChannelName(const juce::String& name);
51
+ juce::String getChannelName() const { return channelName; }
52
+
53
  // Plugin lifecycle
54
  void loadPlugin(const juce::String& pluginPath);
55
  void unloadPlugin();
 
60
  HelperConnection::State getConnectionState() const { return helper.getState(); }
61
  juce::String getLastPluginPath() const { return pluginPath; }
62
 
63
+ // In-process plugin instance (null when plugin is unsafe)
64
  juce::AudioPluginInstance* getInProcessPlugin() const { return inProcessPlugin.get(); }
65
 
66
  // Plugin list
67
  juce::Array<juce::File> getInstalledPluginFiles() const;
68
 
69
+ // Manufacturer name
 
70
  juce::String getPluginManufacturer(const juce::File& pluginFile) const;
71
 
72
  // Blocklist
 
78
  void startBackgroundScan();
79
  void stopBackgroundScan();
80
 
81
+ // Audio analysis
82
  std::string getAnalysis() const { return analyser.getCompactAnalysis(); }
83
 
84
  // Callbacks for editor
85
+ std::function<void()> onPluginWillLoad;
86
  std::function<void()> onPluginLoaded;
87
  std::function<void()> onPluginUnloaded;
88
  std::function<void(const juce::String&)> onLoadFailed;
89
+ std::function<void(const juce::String&, bool)> onScanProgress;
90
 
91
  private:
92
  void loadInProcessPlugin(const juce::String& path);
93
  void unloadInProcessPlugin();
 
 
 
94
  bool runPluginScan(const juce::String& path);
95
 
 
96
  void audioProcessorParameterChanged(juce::AudioProcessor*, int paramIdx, float value) override;
97
  void audioProcessorChanged(juce::AudioProcessor*, const ChangeDetails&) override {}
98
 
 
102
  PluginSafetyDB safetyDB;
103
  AudioAnalyser analyser;
104
 
105
+ // In-process plugin
106
  juce::AudioPluginFormatManager inProcessFormatManager;
107
  std::unique_ptr<juce::AudioPluginInstance> inProcessPlugin;
108
  std::atomic<bool> suppressParamSync{false};
 
112
  juce::String pluginPath;
113
  int pluginParamCount = 0;
114
 
115
+ // Channel identification
116
+ juce::String channelName { "Unnamed" };
117
+
118
  double currentSampleRate = 44100.0;
119
  int currentBlockSize = 512;
120
 
 
121
  std::thread scanThread;
122
  std::atomic<bool> scanRunning{false};
123
 
 
124
  mutable std::map<std::string, std::string> manufacturerCache;
125
  mutable std::mutex manufacturerCacheMutex;
126