Example #1
0
 public static void DisposeVST()
 {
     if (Mixer32 != null) Mixer32.RemoveInputStream(vstStream);
     if (vstStream != null) vstStream.Dispose();
     vstStream = null;
     if (GeneralVST != null) GeneralVST.Dispose();
     GeneralVST = null;
 }
Example #2
0
        public static VST LoadVST(string VSTPath, IntPtr hWnd)
        {
            DisposeVST();

            GeneralVST = new VST();

            HostCommandStub hcs = new HostCommandStub();
            hcs.Directory = System.IO.Path.GetDirectoryName(VSTPath);

            try
            {
                GeneralVST.pluginContext = VstPluginContext.Create(VSTPath, hcs);
                GeneralVST.pluginContext.PluginCommandStub.Open();
                //pluginContext.PluginCommandStub.SetProgram(0);
                GeneralVST.pluginContext.PluginCommandStub.EditorOpen(hWnd);
                GeneralVST.pluginContext.PluginCommandStub.MainsChanged(true);

                vstStream = new VSTStream();
                vstStream.ProcessCalled += new EventHandler<VSTStreamEventArgs>(GeneralVST.Stream_ProcessCalled);
                vstStream.pluginContext = GeneralVST.pluginContext;
                vstStream.SetWaveFormat(44100, 2);

                Mixer32.AddInputStream(vstStream);
                //playbackDevice = new AsioOut(0);//new WaveOut();//
                //playbackDevice.Init(mixer);

                return GeneralVST;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return null;
        }