public new void Dispose() { UtilityAudio.DisposeVst(); vst = null; base.Dispose(); vstFormSingleton = null; }
void LoadToolStripMenuItemClick(object sender, EventArgs e) { if (vstForm != null) { vstForm.Dispose(); vstForm = null; showToolStripMenuItem.Enabled = false; editParametersToolStripMenuItem.Enabled = false; loadToolStripMenuItem.Text = "Load..."; } else { var ofd = new OpenFileDialog(); ofd.Title = "Select VST:"; ofd.Filter = "VST Files (*.dll)|*.dll"; if (LastDirectoryUsed.ContainsKey("VSTDir")) { ofd.InitialDirectory = LastDirectoryUsed["VSTDir"]; } else { ofd.InitialDirectory = UtilityAudio.GetVstDirectory(); } DialogResult res = ofd.ShowDialog(); if (res != DialogResult.OK || !File.Exists(ofd.FileName)) { return; } try { if (LastDirectoryUsed.ContainsKey("VSTDir")) { LastDirectoryUsed["VSTDir"] = Directory.GetParent(ofd.FileName).FullName; } else { LastDirectoryUsed.Add("VSTDir", Directory.GetParent(ofd.FileName).FullName); } vstForm = new VSTForm(ofd.FileName, "nix"); vstForm.Show(); showToolStripMenuItem.Enabled = true; editParametersToolStripMenuItem.Enabled = true; loadToolStripMenuItem.Text = "Unload..."; } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
public VSTForm(string VSTPath, string asioDevice) { vstFormSingleton = this; UtilityAudio.OpenAudio(AudioLibrary.NAudio, asioDevice); InitializeComponent(); vst = UtilityAudio.LoadVst(VSTPath, this.Handle); this.Text = vst.pluginContext.PluginCommandStub.GetProgramName(); var rect = new Rectangle(); vst.pluginContext.PluginCommandStub.EditorGetRect(out rect); this.SetClientSizeCore(rect.Width, rect.Height + 125); vst.StreamCall += vst_StreamCall; UtilityAudio.StartAudio(); }
void MainFormFormClosing(object sender, FormClosingEventArgs e) { if (midiIn != null) { midiIn.Dispose(); midiIn = null; } if (midiOut != null) { midiOut.Dispose(); midiOut = null; } if (vstForm != null) { vstForm.Dispose(); vstForm = null; } UtilityAudio.Dispose(); }
private void VSTForm_FormClosed(object sender, FormClosedEventArgs e) { vstFormSingleton = null; }