public new void Dispose() { UtilityAudio.DisposeVST(); vst = null; base.Dispose(); Singleton = null; }
private void tsbSave_Click(object sender, EventArgs e) { var saveFile = new SaveFileDialog(); saveFile.Title = "Select output file:"; saveFile.Filter = "WAV Files (*.wav)|*.wav"; saveFile.ShowDialog(); UtilityAudio.SaveStream(saveFile.FileName); }
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, comboBoxAudioOutDevices.Text); vstForm.Show(); showToolStripMenuItem.Enabled = true; editParametersToolStripMenuItem.Enabled = true; loadToolStripMenuItem.Text = "Unload..."; } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void tsbRec_CheckedChanged(object sender, EventArgs e) { if (tsbRec.Checked) { tsbRec.BackColor = Color.Red; UtilityAudio.StartStreamingToDisk(); } else { tsbRec.BackColor = Color.Transparent; UtilityAudio.StopStreamingToDisk(); } }
void Timer1Tick(object sender, EventArgs e) { // Call these three functions 'getEditorSize', 'processIdle' and 'processReplacing' continually while the GUI is open. // If size don't change and you don't need to process audio call the functions anyway because plugins can rely on them being called frequently for their redrawing. // http://vstnet.codeplex.com/discussions/281497 // In fact all I had to call was Jacobi.Vst.Core.Host.IVstPluginCommandStub.EditorIdle() // which I do every 100 ms. This works great ;) if (vst != null && doGUIRefresh) { vst.pluginContext.PluginCommandStub.EditorIdle(); } // update play time tslNowTime.Text = UtilityAudio.GetMp3CurrentTime().ToString(); }
private void tsbLoad_Click(object sender, EventArgs e) { var fileDialog = new OpenFileDialog(); fileDialog.Title = "Select MP3 file:"; fileDialog.Filter = "MP3 Files (*.mp3)|*.mp3"; fileDialog.ShowDialog(); if (String.IsNullOrEmpty(fileDialog.FileName)) { return; } UtilityAudio.LoadMP3(fileDialog.FileName); tslTotalTime.Text = " / " + UtilityAudio.GetMp3TotalTime().ToString(); }
public VSTForm(string VSTPath) { Singleton = this; UtilityAudio.OpenAudio(AudioLibrary.NAudio); 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(); }
private void tsbStop_Click(object sender, EventArgs e) { try { if (UtilityAudio.IsMP3Played()) { UtilityAudio.PauseMP3(); tsbStop.Image = (System.Drawing.Image) new System.ComponentModel.ComponentResourceManager(typeof(VSTForm)).GetObject("tsbStop.Image"); } else { UtilityAudio.StopMp3(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
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 tsbPlay_Click(object sender, EventArgs e) { UtilityAudio.PlayMP3(); tsbStop.Image = (System.Drawing.Image) new System.ComponentModel.ComponentResourceManager(typeof(VSTForm)).GetObject("tsbPause.Image"); }
private void tsbMixer_Click(object sender, EventArgs e) { UtilityAudio.ShowMixer(); }