G4.2: bridge-side plugin process pool — SandboxVst3Host spawns/respawns plugin_host.exe per channel, MIDI forward + audio snapshot + watchdog mute/respawn, crash isolation verified

This commit is contained in:
2026-08-16 10:52:04 +07:00
parent 7de00955d8
commit 462a5104d2
10 changed files with 287 additions and 8 deletions
+4 -2
View File
@@ -34,12 +34,14 @@ int main(int argc, char* argv[]) {
double sr = 44100.0;
uint32_t block = AUDIO_BLOCK_SIZE;
uint32_t parentPid = 0;
bool isOpen = false;
for (int i = 1; i < argc; ++i) {
if (strcmp(argv[i], "--shm") == 0 && i + 1 < argc) shmName = argv[++i];
else if (strcmp(argv[i], "--path") == 0 && i + 1 < argc) path = argv[++i];
else if (strcmp(argv[i], "--sr") == 0 && i + 1 < argc) sr = atof(argv[++i]);
else if (strcmp(argv[i], "--block") == 0 && i + 1 < argc) block = (uint32_t)atoi(argv[++i]);
else if (strcmp(argv[i], "--parent") == 0 && i + 1 < argc) parentPid = (uint32_t)strtoul(argv[++i], nullptr, 0);
else if (strcmp(argv[i], "--open") == 0) isOpen = true;
}
if (shmName.empty() || path.empty()) {
printf("usage: plugin_host --shm <name> --path <vst3> [--sr rate] [--block n] [--parent pid]\n");
@@ -53,8 +55,8 @@ int main(int argc, char* argv[]) {
(unsigned long)GetCurrentProcessId(), shmName.c_str(), path.c_str(), sr, block);
fflush(stdout);
// PoC: the child owns the mapping. Bridge adoption (G4.2) opens instead.
ShmHandle* shm = shm_create(shmName.c_str());
// --open: bridge already created the mapping (G4.2); default PoC: child owns.
ShmHandle* shm = isOpen ? shm_open(shmName.c_str()) : shm_create(shmName.c_str());
if (!shm) {
printf("[plugin_host] FAILED shm_create %s\n", shmName.c_str());
return 3;