Ejemplo n.º 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;
 }
Ejemplo n.º 2
0
        //VstPluginContext pluginContext = null;
        //VSTStream vstStream = null;
        //IWavePlayer playbackDevice = null;
        //EditParametersForm edit = new EditParametersForm();
        //RecordableMixerStream32 mixer=new RecordableMixerStream32();
        //WaveChannel32 mp3Channel = null;
        //long mp3Position = 0;
        //MixerForm mixerForm = null;
        public VSTForm(string VSTPath)
        {
            Singleton = this;
            UtilityAudio.OpenAudio(AudioLibrary.NAudio, null);

            InitializeComponent();
            vst = UtilityAudio.LoadVST(VSTPath, this.Handle);
            this.Text = vst.pluginContext.PluginCommandStub.GetProgramName();
            Rectangle rect = new Rectangle();
            vst.pluginContext.PluginCommandStub.EditorGetRect(out rect);
            this.SetClientSizeCore(rect.Width, rect.Height + 125);
            vst.StreamCall += new EventHandler<VSTStreamEventArgs>(vst_StreamCall);

            UtilityAudio.StartAudio();

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

            try
            {
                pluginContext = VstPluginContext.Create(VSTPath, hcs);
                pluginContext.PluginCommandStub.Open();
                this.Text= pluginContext.PluginCommandStub.GetProgramName();
                //pluginContext.PluginCommandStub.SetProgram(0);
                pluginContext.PluginCommandStub.EditorOpen(this.Handle);
                Rectangle rect = new Rectangle();
                pluginContext.PluginCommandStub.EditorGetRect(out rect);
                this.SetClientSizeCore(rect.Width, rect.Height+125);
                pluginContext.PluginCommandStub.MainsChanged(true);

                vstStream = new VSTStream();
                vstStream.ProcessCalled += new EventHandler<ProcessCalledEventArgs>(vstStream_ProcessCalled);
                vstStream.pluginContext = pluginContext;
                vstStream.SetWaveFormat(44100, 2);

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

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }*/
        }
Ejemplo n.º 3
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;
        }
Ejemplo n.º 4
0
        public new void Dispose()
        {
            /*edit.Close();

            playbackDevice.Stop();
            playbackDevice.Dispose();
            pluginContext.Dispose();
            if(mp3Channel!=null)
                mp3Channel.Dispose();
            if(mixerForm!=null)
                mixerForm.Close();
            */
            UtilityAudio.DisposeVST();
            vst = null;
            base.Dispose();

            Singleton = null;
        }