//load from file private VstPluginContext OpenPlugin(string pluginPath) { try { HostCommandStub hostCmdStub = new HostCommandStub(); hostCmdStub.PluginCalled += HostCmdStub_PluginCalled; hostCmdStub.RaiseSave = SetNeedsSafe; VstPluginContext ctx = VstPluginContext.Create(pluginPath, hostCmdStub); var midiOutChannels = ctx.PluginCommandStub.GetNumberOfMidiOutputChannels(); //if(midiOutChannels > 0) { hostCmdStub.FProcessEventsAction = ReceiveEvents; } // add custom data to the context ctx.Set("PluginPath", pluginPath); ctx.Set("HostCmdStub", hostCmdStub); // actually open the plugin itself ctx.PluginCommandStub.Open(); return(ctx); } catch (Exception e) { MessageBox.Show(FOwnerWindow, e.ToString(), "VST Load", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(null); }
private void HostCmdStub_PluginCalled(object sender, PluginCalledEventArgs e) { HostCommandStub hostCmdStub = (HostCommandStub)sender; // can be null when called from inside the plugin main entry point. if (hostCmdStub.PluginContext.PluginInfo != null) { Debug.WriteLine("Plugin " + hostCmdStub.PluginContext.PluginInfo.PluginID + " called:" + e.Message); } else { Debug.WriteLine("The loading Plugin called:" + e.Message); } }
//load from file private VstPluginContext OpenPlugin(string pluginPath) { try { HostCommandStub hostCmdStub = new HostCommandStub(); hostCmdStub.PluginCalled += HostCmdStub_PluginCalled; hostCmdStub.RaiseSave = SetNeedsSafe; VstPluginContext ctx = VstPluginContext.Create(pluginPath, hostCmdStub); var midiOutChannels = ctx.PluginCommandStub.GetNumberOfMidiOutputChannels(); //if(midiOutChannels > 0) { hostCmdStub.FProcessEventsAction = ReceiveEvents; } // add custom data to the context ctx.Set("PluginPath", pluginPath); ctx.Set("HostCmdStub", hostCmdStub); // actually open the plugin itself ctx.PluginCommandStub.Open(); return ctx; } catch (Exception e) { MessageBox.Show(FOwnerWindow, e.ToString(), "VST Load", MessageBoxButtons.OK, MessageBoxIcon.Error); } return null; }