コード例 #1
0
        public new void Dispose()
        {
            UtilityAudio.DisposeVST();
            vst = null;
            base.Dispose();

            Singleton = null;
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
                }
            }
        }
コード例 #4
0
 private void tsbRec_CheckedChanged(object sender, EventArgs e)
 {
     if (tsbRec.Checked)
     {
         tsbRec.BackColor = Color.Red;
         UtilityAudio.StartStreamingToDisk();
     }
     else
     {
         tsbRec.BackColor = Color.Transparent;
         UtilityAudio.StopStreamingToDisk();
     }
 }
コード例 #5
0
        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();
        }
コード例 #6
0
        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();
        }
コード例 #7
0
        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();
        }
コード例 #8
0
 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);
     }
 }
コード例 #9
0
 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();
 }
コード例 #10
0
 private void tsbPlay_Click(object sender, EventArgs e)
 {
     UtilityAudio.PlayMP3();
     tsbStop.Image = (System.Drawing.Image) new System.ComponentModel.ComponentResourceManager(typeof(VSTForm)).GetObject("tsbPause.Image");
 }
コード例 #11
0
 private void tsbMixer_Click(object sender, EventArgs e)
 {
     UtilityAudio.ShowMixer();
 }