public VstSettings GetVstSettings() { var vstSettings = new VstSettings(); foreach (var plugin in VstPlugins) { var settings = new KeyValuePair <string, string>(plugin.Location, PluginHelper.GetVstPluginParameters(plugin)); vstSettings.Plugins.Add(settings); } return(vstSettings); }
public void ApplyVstSettings(VstSettings vstSettings) { foreach (var plugin in VstPlugins) { ClearVstPlugin(VstPlugins.IndexOf(plugin)); } foreach (var settings in vstSettings.Plugins) { var index = vstSettings.Plugins.IndexOf(settings); var plugin = LoadVstPlugin(settings.Key, index); PluginHelper.SetVstPluginParameters(plugin, settings.Value); } }
/// <summary> /// /// </summary> /// <param name="context"></param> /// <param name="provider"></param> /// <param name="value"></param> /// <returns></returns> public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { IWindowsFormsEditorService editorService = null; VstSettings vs = (VstSettings)value; if (provider != null) { editorService = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService; } if (editorService == null || vs == null) { return(value); } VstPlugin plugin = (VstPlugin)context.Instance; if (!openedFrame.ContainsKey(plugin)) { FormVstEditorFrame dlg = new FormVstEditorFrame(); { lock (InstrumentBase.VstPluginContextLockObject) { var ctx = vs.VstPluginContext; if (ctx != null) { dlg.PluginCommandStub = ctx.Context.PluginCommandStub; } } try { InstrumentManager.InstExclusiveLockObject.EnterReadLock(); InstrumentBase targetInst = null; foreach (var inst in InstrumentManager.GetAllInstruments()) { foreach (var i in inst.VSTPlugins) { if (i == plugin) { targetInst = inst; break; } } if (targetInst != null) { break; } } dlg.FormClosed += Dlg_FormClosed; plugin.PluginDisposing += Plugin_PluginDisposing; openedFrame.Add(plugin, dlg); dlg.Show(null, targetInst); } finally { InstrumentManager.InstExclusiveLockObject.ExitReadLock(); } } } else { openedFrame[plugin].BringToFront(); } return(value); }
public VstSettings GetVstSettings() { var vstSettings = new VstSettings(); foreach (var plugin in VstPlugins) { var settings = new KeyValuePair<string, string>(plugin.Location, PluginHelper.GetVstPluginParameters(plugin)); vstSettings.Plugins.Add(settings); } return vstSettings; }