Esempio n. 1
0
 /// <summary>
 /// Called to dispose this object instance.
 /// </summary>
 /// <param name="disposing">When true also disposes of managed resources. Otherwise only unmanaged resources are disposed.</param>
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         _hostCmdStub = null;
     }
 }
Esempio n. 2
0
        /// <summary>
        /// A factory method to create the correct <see cref="VstHostCommandAdapter"/> class type.
        /// </summary>
        /// <param name="hostCmdStub">A reference to the host command stub. Must not be null.</param>
        /// <returns>Returns an instance of <see cref="Deprecated.VstHostCommandDeprecatedAdapter"/> when the <paramref name="hostCmdStub"/> supports deprecated methods.</returns>
        public static VstHostCommandAdapter Create(IVstHostCommandStub hostCmdStub)
        {
            if (hostCmdStub is Deprecated.IVstHostCommandsDeprecated20)
            {
                return(new Deprecated.VstHostCommandDeprecatedAdapter(hostCmdStub));
            }

            return(new VstHostCommandAdapter(hostCmdStub));
        }
Esempio n. 3
0
        /// <summary>
        /// Constructs a new instance of the host class based on the <paramref name="hostCmdStub"/>
        /// (from Interop) and a reference to the current <paramref name="plugin"/>.
        /// </summary>
        /// <param name="hostCmdStub">Must not be null.</param>
        /// <param name="plugin">Must not be null.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="hostCmdStub"/> or
        /// <paramref name="plugin"/> is not set to an instance of an object.</exception>
        public VstHost(IVstHostCommandStub hostCmdStub, IVstPlugin plugin)
        {
            Throw.IfArgumentIsNull(hostCmdStub, "hostCmdStub");
            Throw.IfArgumentIsNull(plugin, "plugin");

            HostCommandStub = hostCmdStub;
            Plugin          = plugin;

            _intfMgr = new VstHostInterfaceManager(this);
        }
Esempio n. 4
0
        /// <inheritdoc />
        public void Close()
        {
            // Calling back into the Form at this point can cause a dead-lock.
            //Log("Close");

            // perform cleanup of the host stub
            if (_hostStub != null)
            {
                _hostStub.Dispose();
                _hostStub = null;

                _pluginInfo = null;
            }
        }
Esempio n. 5
0
        //private WpfControlWrapper<EditorControl> _editorCtrl = new WpfControlWrapper<EditorControl>(300, 300);

        #region IVstPluginCommandStub Members

        /// <inheritdoc />
        public VstPluginInfo GetPluginInfo(IVstHostCommandStub hostCmdStub)
        {
            _hostStub   = hostCmdStub;
            _pluginInfo = new VstPluginInfo();

            _pluginInfo.AudioInputCount  = 1;
            _pluginInfo.AudioOutputCount = 2;
            _pluginInfo.ProgramCount     = 1;
            _pluginInfo.Flags            = VstPluginFlags.HasEditor | VstPluginFlags.CanReplacing;
            _pluginInfo.PluginID         = 1234;
            _pluginInfo.PluginVersion    = 1000;

            return(_pluginInfo);
        }
        public VstPluginInfo GetPluginInfo(IVstHostCommandStub hostCmdStub)
        {
            //
            // get the path to the wrapped plugin from config
            //

            if (PluginConfiguration == null)
            {
                throw new ApplicationException("No plugin configuration found.");
            }

            KeyValueConfigurationElement configElem = PluginConfiguration.AppSettings.Settings["PluginPath"];

            if (configElem == null)
            {
                throw new ApplicationException("The 'PluginPath' configuration (app) setting was not found.");
            }

            Host.HostCommandStubAdapter hostCmdAdapter = new Host.HostCommandStubAdapter(hostCmdStub);
            _pluginCtx = VstPluginContext.Create(configElem.Value, hostCmdAdapter);

            return(_pluginCtx.PluginInfo);
        }
 public HostCommandStubAdapter(IVstHostCommandStub hostCmdStub)
 {
     _hostCmdStub = hostCmdStub;
 }
        /// <summary>
        /// Constructs a new instance based on the <paramref name="hostCmdStub"/>
        /// </summary>
        /// <param name="hostCmdStub">Will be used to forward calls to. Must not be null.</param>
        public VstHostCommandAdapter(IVstHostCommandStub hostCmdStub)
        {
            Throw.IfArgumentIsNull(hostCmdStub, nameof(hostCmdStub));

            _hostCmdStub = hostCmdStub;
        }
 /// <summary>
 /// Constructs a new adapter instance on the passed <paramref name="hostCmdStub"/>.
 /// </summary>
 /// <param name="hostCmdStub">An implementation of the <see cref="IVstHostCommandsDeprecated20"/> interface. Must not be null.</param>
 public VstHostCommandDeprecatedAdapter(IVstHostCommandStub hostCmdStub)
     : base(hostCmdStub)
 {
     _deprecatedStub = (IVstHostCommandsDeprecated20)hostCmdStub;
 }
        /// <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(IVstHostCommandStub hostCmdStub)
        {
            IVstPlugin plugin = CreatePluginInstance();

            if (plugin != null)
            {
                pluginCtx = new VstPluginContext();
                pluginCtx.Host = new Host.VstHost(hostCmdStub, plugin);
                pluginCtx.Plugin = plugin;
                pluginCtx.PluginInfo = CreatePluginInfo(plugin);

                return pluginCtx.PluginInfo;
            }

            return null;
        }
        public VstPluginInfo GetPluginInfo(IVstHostCommandStub hostCmdStub)
        {
            _hostStub = hostCmdStub;
            _pluginInfo = new VstPluginInfo();
            _pluginInfo.ParameterCount = theSynth.parameters.Length;
            _pluginInfo.AudioInputCount = 0;
            _pluginInfo.AudioOutputCount = 2;
            _pluginInfo.ProgramCount = progs.Length;
            _pluginInfo.Flags = Jacobi.Vst.Core.VstPluginFlags.IsSynth | VstPluginFlags.HasEditor;
            //_pluginInfo.PluginID = ?;
            //_pluginInfo.PluginVersion = ?;

            return _pluginInfo;
        }
 /// <summary>
 /// Constructs a new adapter instance on the passed <paramref name="hostCmdStub"/>.
 /// </summary>
 /// <param name="hostCmdStub">An implementation of the <see cref="IVstHostCommandsDeprecated20"/> interface. Must not be null.</param>
 public VstHostCommandDeprecatedAdapter(IVstHostCommandStub hostCmdStub)
     : base(hostCmdStub)
 {
     _deprecatedStub = (IVstHostCommandsDeprecated20)hostCmdStub;
 }