/// <summary> /// Constructs a new instance of the host class based on the <paramref name="hostCmdProxy"/> /// (from Interop) and a reference to the current <paramref name="plugin"/>. /// </summary> /// <param name="hostCmdProxy">Must not be null.</param> /// <param name="plugin">Must not be null.</param> /// <exception cref="ArgumentNullException">Thrown when <paramref name="hostCmdProxy"/> or /// <paramref name="plugin"/> is not set to an instance of an object.</exception> public VstHost(IVstHostCommandProxy hostCmdProxy, IVstPlugin plugin) { Throw.IfArgumentIsNull(hostCmdProxy, nameof(hostCmdProxy)); Throw.IfArgumentIsNull(plugin, nameof(plugin)); HostCommandProxy = hostCmdProxy; Plugin = plugin; _automation = new VstHostAutomation(this); _sequencer = new VstHostSequencer(this); _shell = new VstHostShell(this); _midiProcessor = new VstHostMidiProcessor(this); }
public VstPluginInfo GetPluginInfo(IVstHostCommandProxy hostCmdProxy) { // // get the path to the wrapped plugin from config // if (PluginConfiguration == null) { throw new InvalidOperationException("No plugin configuration found."); } var pluginPath = PluginConfiguration["PluginPath"]; Host.HostCommandStubAdapter hostCmdAdapter = new Host.HostCommandStubAdapter(hostCmdProxy); _pluginCtx = VstPluginContext.Create(pluginPath, hostCmdAdapter); return(_pluginCtx.PluginInfo); }
/// <summary> /// Called by the Interop loader to retrieve the plugin information. /// </summary> /// <param name="hostCmdStub">Must not be null.</param> /// <returns>Returns a fully populated <see cref="VstPluginInfo"/> instance. Never returns null.</returns> /// <remarks>Override <see cref="CreatePluginInfo"/> to change the default behavior of how the plugin info is built.</remarks> public VstPluginInfo?GetPluginInfo(IVstHostCommandProxy hostCmdStub) { IVstPlugin plugin = CreatePluginInstance(); if (plugin != null) { if (plugin is IConfigurable config) { config.Configuration = this.PluginConfiguration; } _pluginCtx = new VstPluginContext( plugin, new Host.VstHost(hostCmdStub, plugin), CreatePluginInfo(plugin)); Commands = CreatePluginCommands(_pluginCtx); return(_pluginCtx.PluginInfo); } return(null); }
public HostCommandStubAdapter(IVstHostCommandProxy hostCmdProxy) { _hostCmdProxy = hostCmdProxy; }
public VstPluginInfo GetPluginInfo(IVstHostCommandProxy hostCmdProxy) { _hostAdapter = new Host.HostCommandStubAdapter(hostCmdProxy); _commands.OnLoadPlugin = _hostAdapter.OnLoadPlugin; return(_hostAdapter.PluginInfo); }