Out-of-process rebuild: Add Shared/IPCProtocol.h — message definitions for parent↔helper IPC
Browse files1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798#pragma once
#include <string>#include <cstdint>
// IPC Protocol between PluginBridge (parent) and PluginBridgeHelper (child)// Transport: Unix domain socket, newline-delimited JSON messages// // Flow:// Parent → Helper: commands (load plugin, get/set params, show GUI, quit)// Helper → Parent: responses + notifications (param changes from GUI, crash)
namespace IPC {
// Socket path (unique per instance using PID)inline std::string getSocketPath(int parentPid){ return "/tmp/pluginbridge_" + std::to_string(parentPid) + ".sock";}
// Shared memory name (unique per instance)inline std::string getShmName(int parentPid){ return "pluginbridge_audio_" + std::to_string(parentPid);}
// Semaphore namesinline std::string getInputSemName(int parentPid){ return "pb_input_" + std::to_string(parentPid);}
inline std::string getOutputSemName(int parentPid){ return "pb_output_" + std::to_string(parentPid);}
// --- Message Types (Parent → Helper) ---
// Load a plugin by file path// {"cmd":"load","path":"/Library/Audio/Plug-Ins/VST3/Pro-Q 4.vst3"}// Response: {"ok":true,"name":"Pro-Q 4","params":737} or {"ok":false,"error":"..."}
// Unload current plugin// {"cmd":"unload"}// Response: {"ok":true}
// Search parameters by keyword// {"cmd":"search_param","keyword":"gain"}// Response: {"ok":true,"results":[{"i":12,"n":"Band 1 Gain","v":0.5,"t":"0.0 dB"},...]}
// Get parameter values by index// {"cmd":"get_params","ids":[12,13,14]}// Response: {"ok":true,"values":{"12":0.5,"13":0.7,"14":0.0}}
// Set parameter values// {"cmd":"set_params","values":{"12":0.75,"13":0.3}}// Response: {"ok":true}
// Show/hide plugin GUI// {"cmd":"show_gui"}// {"cmd":"hide_gui"}// Response: {"ok":true}
// Get plugin state (for save)// {"cmd":"get_state"}// Response: {"ok":true,"state":"<base64-encoded state>"}
// Set plugin state (for restore)// {"cmd":"set_state","state":"<base64-encoded state>"}// Response: {"ok":true}
// Configure audio// {"cmd":"configure","sampleRate":44100,"blockSize":512,"channels":2}// Response: {"ok":true}
// Quit helper// {"cmd":"quit"}// No response (process exits)
// --- Message Types (Helper → Parent, unsolicited notifications) ---
// Parameter changed from GUI interaction// {"notify":"param_changed","index":12,"value":0.75}
// Plugin crashed (sent if helper catches it before dying)// {"notify":"crashed","error":"..."}
// Helper ready (sent after startup)// {"notify":"ready"}
// --- Constants ---
static constexpr int kMaxMessageSize = 65536; // 64KB max for state blobsstatic constexpr int kHelperTimeoutMs = 5000; // 5s to start upstatic constexpr int kProcessBlockTimeoutMs = 50; // 50ms max wait in processBlock
} // namespace IPCSource/Shared/IPCProtocol.hAdded+98