示例#1
0
        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
        public void Test_MaxLength_VstSpeakerProperties_Name()
        {
            VstSpeakerProperties mpn = new VstSpeakerProperties();

            Assert.AreEqual(null, mpn.Name);

            mpn.Name = String.Empty;
            Assert.AreEqual(String.Empty, mpn.Name);

            string testData = CreateString(Constants.MaxMidiNameLength);

            mpn.Name = testData;
            Assert.AreEqual(testData, mpn.Name);

            testData += "X";
            mpn.Name  = testData;
            Assert.Fail("should have thrown an exception.");
        }
示例#3
0
        public void Test_MaxLength_VstSpeakerProperties_Name()
        {
            var mpn = new VstSpeakerProperties();

            mpn.Name.Should().BeEmpty();

            mpn.Name = String.Empty;
            mpn.Name.Should().BeEmpty();

            string testData = CreateString(Constants.MaxMidiNameLength);

            mpn.Name = testData;
            mpn.Name.Should().Be(testData);

            testData += "X";
            mpn.Name  = testData;
            Assert.Fail("should have thrown an exception.");
        }