コード例 #1
0
ファイル: MainForm.cs プロジェクト: terminar/PresetMagician
        private VstPluginContext OpenPlugin(string pluginPath)
        {
            try
            {
                HostCommandStub hostCmdStub = new HostCommandStub();
                //hostCmdStub.PluginCalled += new EventHandler<PluginCalledEventArgs>(HostCmdStub_PluginCalled);

                VstPluginContext ctx = VstPluginContext.Create(pluginPath, hostCmdStub);

                // add custom data to the context
                ctx.Set("PluginPath", pluginPath);
                ctx.Set("HostCmdStub", hostCmdStub);

                // actually open the plugin itself
                ctx.PluginCommandStub.Open();
                ctx.PluginCommandStub.SetSampleRate(44100f);
                ctx.PluginCommandStub.SetBlockSize(512);

                ctx.PluginCommandStub.MainsChanged(true);
                ctx.PluginCommandStub.StartProcess();

                var sp = new VstSpeakerArrangement();

                sp.Type = VstSpeakerArrangementType.SpeakerArrStereo;


                VstSpeakerProperties[] f = new VstSpeakerProperties[2];

                f[0]             = new VstSpeakerProperties();
                f[1]             = new VstSpeakerProperties();
                f[0].SpeakerType = VstSpeakerTypes.SpeakerL;
                f[1].SpeakerType = VstSpeakerTypes.SpeakerR;

                sp.Speakers = f;

                var spin = new VstSpeakerArrangement();
                spin.Type = VstSpeakerArrangementType.SpeakerArrEmpty;

                VstSpeakerProperties[] f2 = new VstSpeakerProperties[0];

                spin.Speakers = f2;

                //ctx.PluginCommandStub.SetSpeakerArrangement(spin, sp);

                return(ctx);
            }
            catch (Exception e)
            {
                MessageBox.Show(this, e.ToString(), Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            return(null);
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: terminar/PresetMagician
        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);
            }
        }