private void UpdateProcesses(object o) { lock (_updateLock) { if (_updateProcessesRunning) { return; } _updateProcessesRunning = true; var processesToRemove = new List <IVstHostProcess>(); foreach (var process in RunningProcesses) { if (process.CurrentProcessState == ProcessState.EXITED) { UnwatchProcess(process); processesToRemove.Add(process); OldProcesses.Add(process); } } foreach (var process in processesToRemove) { RunningProcesses.Remove(process); } if (PoolRunning) { if (RunningProcesses.Count < _maxProcesses) { var process = new VstHostProcess(_maxStartTimeout); process.ProcessStateUpdated += ProcessOnProcessStateUpdated; process.Start(); RunningProcesses.Add(process); _totalStartedProcesses++; } } NumRunningProcesses = (from process in RunningProcesses where process.CurrentProcessState == ProcessState.RUNNING select process).Count(); NumTotalProcesses = RunningProcesses.Count; _updateProcessesRunning = false; } }
public async Task <IRemotePluginInstance> GetInteractivePluginInstance(Plugin plugin) { if (_interactiveVstHostProcess == null) { _interactiveVstHostProcess = new VstHostProcess(20, true); _interactiveVstHostProcess.Start(); _interactiveVstHostProcess.WaitUntilStarted(); } if (!_pluginInstances.ContainsKey(plugin)) { _pluginInstances.Add(plugin, new RemotePluginInstance(_interactiveVstHostProcess, plugin, true, true)); } return(_pluginInstances[plugin]); }