Exemple #1
0
        void PlayMidiC5100msBtnClick(object sender, EventArgs e)
        {
            VstHost host = VstHost.Instance;

            host.PluginContext = this.PluginContext;
            host.doPluginOpen();

            InitPlayback();
            Playback.Play();

            // time how long this took
            Stopwatch stopwatch = Stopwatch.StartNew();

            // end midi note on
            host.SendMidiNote(host.SendContinousMidiNote, host.SendContinousMidiNoteVelocity);

            // wait 100 ms
            System.Threading.Thread.Sleep(100);

            // send midi note off
            host.SendMidiNote(host.SendContinousMidiNote, 0);

            stopwatch.Stop();
            Console.WriteLine("Midi Note Sent. Time used {0} ms", stopwatch.ElapsedMilliseconds);
        }
Exemple #2
0
        void EditorFrameKeyUp(object sender, KeyEventArgs e)
        {
            if ((PluginContext.PluginInfo.Flags & VstPluginFlags.CanReplacing) == 0)
            {
                return;
            }

            hasNoKeyDown = true;             // Set to True to enable next KeyDown event

            try
            {
                byte midiVelocity = 0;
                byte midiNote     = KeyEventArgToMidiNote(e);

                System.Diagnostics.Debug.WriteLine("Key Up Event Detected: {0}, {1}, {2}", e.KeyCode, midiNote, midiVelocity);

                // only bother with the keys that trigger midi notes
                if (midiNote != 0)
                {
                    VstHost host = VstHost.Instance;
                    host.PluginContext = this.PluginContext;

                    host.SendMidiNote(midiNote, midiVelocity);
                }
            } catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #3
0
        void MidiNoteCheckboxCheckedChanged(object sender, EventArgs e)
        {
            VstHost host = VstHost.Instance;

            host.PluginContext = this.PluginContext;
            host.doPluginOpen();

            // if first keypress setup audio
            if (playback == null)
            {
                // with iblock=1...Nblocks and blocksize = Fs * tblock. Fs = 44100 and
                // tblock = 0.15 makes blocksize = 6615.
                int sampleRate = 44100;
                int blockSize  = (int)(sampleRate * 0.15f);                 //6615;
                int channels   = 2;
                host.Init(blockSize, sampleRate, channels);

                playback = new VstPlaybackNAudio(host);
                playback.Play();
            }

            CheckBox check = (CheckBox)sender;

            if (check.Checked)
            {
                host.SendMidiNote(host.SendContinousMidiNote, host.SendContinousMidiNoteVelocity);
            }
            else
            {
                host.SendMidiNote(host.SendContinousMidiNote, 0);
            }
        }
        void MeasureLFOInit()
        {
            VstHost host = VstHost.Instance;

            host.PluginContext = this.PluginContext;
            host.doPluginOpen();
            SetupAudio(host);

            // init
            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_AMP_ENV1_ATTACK, 0.0f);
            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_AMP_ENV1_DECAY, 0.0f);
            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_AMP_ENV1_SUSTAIN, 1.0f);
            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_AMP_ENV1_RELEASE, 0.0f);

            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_LFO1_GAIN, 1.0f);
            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_LFO1_RATE, 0.0f);
            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_LFO1_WAVE,
                                                         PresetConverter.Sylenth1Preset.EnumUintToFloat(
                                                             (uint)PresetConverter.Sylenth1Preset.LFOWAVE.LFO_Pulse));

            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_OSC1_VOLUME, 0.5f);
            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_OSC1_WAVE,
                                                         PresetConverter.Sylenth1Preset.EnumUintToFloat(
                                                             (uint)PresetConverter.Sylenth1Preset.OSCWAVE.OSC_Pulse));

            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_YMOD_LFO1_DEST1,
                                                         PresetConverter.Sylenth1Preset.EnumUintToFloat(
                                                             (uint)PresetConverter.Sylenth1Preset.YMODDEST.VolumeAB));
            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_XMOD_LFO1_DEST1AMOUNT, 1.0f);

            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_YMOD_ENV1_DEST1,
                                                         PresetConverter.Sylenth1Preset.EnumUintToFloat(
                                                             (uint)PresetConverter.Sylenth1Preset.YMODDEST.None));
            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_XMOD_ENV1_DEST1AMOUNT, 0.0f);
        }
Exemple #5
0
        void AnalyseBtnClick(object sender, EventArgs e)
        {
            VstHost host = VstHost.Instance;

            host.PluginContext = this.PluginContext;
            host.doPluginOpen();

            // if first keypress setup audio
            if (playback == null)
            {
                // with iblock=1...Nblocks and blocksize = Fs * tblock. Fs = 44100 and
                // tblock = 0.15 makes blocksize = 6615.
                int sampleRate = 44100;
                int blockSize  = (int)(sampleRate * 0.15f);                 //6615;
                int channels   = 2;
                host.Init(blockSize, sampleRate, channels);

                playback = new VstPlaybackNAudio(host);
                playback.Play();
            }

            AnalyseForm dlg = new AnalyseForm();

            dlg.PluginContext = this.PluginContext;
            dlg.Playback      = playback;

            //dlg.ShowDialog(this); // modal
            dlg.Show();             // modeless
        }
Exemple #6
0
 void Timer1Tick(object sender, EventArgs e)
 {
     if (DoGUIRefresh)
     {
         VstHost host = VstHost.Instance;
         this.frequencyAnalyserUserControl1.SetAudioData(host.LastProcessedBufferLeft);
     }
 }
Exemple #7
0
        private void ClearAudio()
        {
            VstHost host = VstHost.Instance;

            host.ClearRecording();

            this.waveDisplayUserControl1.SetAudioData(host.RecordedLeft.ToArray());
        }
Exemple #8
0
        void StopBtnClick(object sender, EventArgs e)
        {
            VstHost host = VstHost.Instance;

            host.Record = false;

            this.waveDisplayUserControl1.SetAudioData(host.RecordedLeft.ToArray());
        }
        void SaveWAVBtnClick(object sender, EventArgs e)
        {
            // store this in a wav ouput file.
            string wavFilePath = String.Format("audio-data-{0}.wav", StringUtils.GetCurrentTimestamp());

            VstHost host = VstHost.Instance;

            AudioUtilsNAudio.CreateWaveFile(host.RecordedLeft.ToArray(), wavFilePath, new WaveFormat(host.SampleRate, 1));
        }
Exemple #10
0
 public EffectProxy(
     VstHost vstHost,
     string library,
     bool is64,
     ILoggerFactory loggerFactory
     )
 {
     _loggerFactory = loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory));
     _logger        = _loggerFactory.CreateLogger <EffectProxy>();
     _parent        = vstHost;
 }
        void PluginFormFormClosing(object sender, FormClosingEventArgs e)
        {
            if (playback != null)
            {
                playback.Dispose();
            }

            VstHost host = VstHost.Instance;

            host.DisposeInputWave();
        }
        public WaveDisplayForm()
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            VstHost host = VstHost.Instance;

            this.waveDisplayUserControl1.SetAudioData(host.RecordedLeft.ToArray());
        }
        private void ClearAudio()
        {
            VstHost host = VstHost.Instance;

            host.ClearRecording();

            MaxResolutionTrackBar.Maximum       = 100;
            MaxResolutionTrackBar.TickFrequency = 10;

            this.waveDisplayUserControl1.Resolution = 1;
            this.waveDisplayUserControl1.SetAudioData(host.RecordedLeft.ToArray());
        }
        void ClearBtnClick(object sender, EventArgs e)
        {
            VstHost host = VstHost.Instance;

            host.ClearRecording();

            MaxResolutionTrackBar.Maximum       = 100;
            MaxResolutionTrackBar.TickFrequency = 10;

            this.waveDisplayUserControl1.Resolution = 1;
            this.waveDisplayUserControl1.SetAudioData(host.RecordedLeft.ToArray());
        }
Exemple #15
0
        private void CropAudio()
        {
            VstHost host = VstHost.Instance;

            // crop the audio at silence
            float[] data = AudioUtils.CropAudioAtSilence(host.RecordedLeft.ToArray(), 0, false, 0);

            host.RecordedLeft.Clear();
            host.RecordedLeft.AddRange(data);

            this.waveDisplayUserControl1.SetAudioData(host.RecordedLeft.ToArray());
        }
        void Timer1Tick(object sender, EventArgs e)
        {
            if (DoGUIRefresh)
            {
                VstHost host = VstHost.Instance;

                // update while recording
                if (host.Record)
                {
                    this.waveDisplayUserControl1.Resolution = (int)this.waveDisplayUserControl1.MaxResolution;
                }
                this.waveDisplayUserControl1.SetAudioData(host.RecordedLeft.ToArray());
            }
        }
Exemple #17
0
        void EditorFrameKeyDown(object sender, KeyEventArgs e)
        {
            if ((PluginContext.PluginInfo.Flags & VstPluginFlags.CanReplacing) == 0)
            {
                return;
            }

            if (hasNoKeyDown)
            {
                try
                {
                    byte midiVelocity = 100;
                    byte midiNote     = KeyEventArgToMidiNote(e);

                    System.Diagnostics.Debug.WriteLine("Key Down Event Detected: {0}, {1}, {2}", e.KeyCode, midiNote, midiVelocity);

                    // only bother with the keys that trigger midi notes
                    if (midiNote != 0)
                    {
                        VstHost host = VstHost.Instance;
                        host.PluginContext = this.PluginContext;

                        // if first keypress setup audio
                        if (playback == null)
                        {
                            // with iblock=1...Nblocks and blocksize = Fs * tblock. Fs = 44100 and
                            // tblock = 0.15 makes blocksize = 6615.
                            int sampleRate = 44100;
                            int blockSize  = (int)(sampleRate * 0.15f);                             //6615;
                            int channels   = 2;
                            host.Init(blockSize, sampleRate, channels);

                            playback = new VstPlaybackNAudio(host);
                            playback.Play();
                        }

                        host.SendMidiNote(midiNote, midiVelocity);

                        hasNoKeyDown = false;                         // Set to False to disable keyboard Auto Repeat
                    }
                } catch (Exception ex) {
                    System.Diagnostics.Debug.WriteLine(ex.StackTrace);
                    MessageBox.Show(ex.Message);
                }
            }
            else
            {
                hasNoKeyDown = false;                 // Set to False to disable keyboard Auto Repeat
            }
        }
Exemple #18
0
		void LoadBtnClick(object sender, EventArgs e)
		{
			var dialog = new OpenFileDialog();
			dialog.Filter = "Effect Preset Files (.fxp)|*.fxp|Effect Bank Files (.fxb)|*.fxb|All Files|*.*||";
			if (dialog.ShowDialog(this) == DialogResult.OK)
			{
				string fxpFilePath = dialog.FileName;
				VstHost host = VstHost.Instance;
				host.PluginContext = this.PluginContext;
				
				host.LoadFXP(fxpFilePath);
				FillProgram(PluginContext.PluginCommandStub.GetProgram());
			}
		}
        private void SetupAudio(VstHost host)
        {
            // if first keypress setup audio
            if (Playback == null)
            {
                // with iblock=1...Nblocks and blocksize = Fs * tblock. Fs = 44100 and
                // tblock = 0.15 makes blocksize = 6615.
                int sampleRate = 44100;
                int blockSize  = (int)(sampleRate * 0.15f);                 //6615;
                int channels   = 2;
                host.Init(blockSize, sampleRate, channels);

                Playback = new VstPlaybackNAudio(host);
            }
        }
Exemple #20
0
        public AnalyseForm()
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            string stringSize = "" + this.frequencyAnalyserUserControl1.FFTWindowsSize;

            WindowsSizeComboBox.Text = stringSize;

            VstHost host = VstHost.Instance;

            this.frequencyAnalyserUserControl1.SetAudioData(host.LastProcessedBufferLeft);
        }
Exemple #21
0
		void SaveBtnClick(object sender, EventArgs e)
		{
			var dialog = new SaveFileDialog();
			dialog.Filter = "Effect Preset Files (.fxp)|*.fxp|Effect Bank Files (.fxb)|*.fxb|All Files|*.*||";
			if (dialog.ShowDialog(this) == DialogResult.OK)
			{
				string comboBoxStringValue = presetComboBox.Text;
				this.PluginContext.PluginCommandStub.SetProgramName(comboBoxStringValue);
				string fxpFilePath = dialog.FileName;
				VstHost host = VstHost.Instance;
				host.PluginContext = this.PluginContext;
				host.SaveFXP(fxpFilePath);
				FillProgram(PluginContext.PluginCommandStub.GetProgram());
			}
		}
        /// <summary>
        /// Disposes all members, cascades the Dispose call.
        /// </summary>
        public void Dispose()
        {
            PluginInfo = null;

            if (Plugin != null)
            {
                Plugin.Dispose();
                Plugin = null;
            }

            if (Host != null)
            {
                Host.Dispose();
                Host = null;
            }
        }
Exemple #23
0
        /// <summary>
        /// Disposes all members, cascades the Dispose call.
        /// </summary>
        public void Dispose()
        {
            PluginInfo = null;

            if (Plugin != null)
            {
                Plugin.Dispose();
                Plugin = null;
            }

            if (Host != null)
            {
                Host.Dispose();
                Host = null;
            }
        }
Exemple #24
0
        void InitPlayback()
        {
            // if first keypress setup audio
            if (Playback == null)
            {
                VstHost host = VstHost.Instance;

                // with iblock=1...Nblocks and blocksize = Fs * tblock. Fs = 44100 and
                // tblock = 0.15 makes blocksize = 6615.
                const int sampleRate = 44100;
                const int blockSize  = 6615;
                const int channels   = 2;
                host.Init(blockSize, sampleRate, channels);

                Playback = new VstPlaybackNAudio(host);
            }
        }
        void StopBtnClick(object sender, EventArgs e)
        {
            VstHost host = VstHost.Instance;

            host.Record = false;

            MaxResolutionTrackBar.Maximum       = (int)this.waveDisplayUserControl1.MaxResolution;
            MaxResolutionTrackBar.TickFrequency = MaxResolutionTrackBar.Maximum / 10;
            MaxResolutionTrackBar.Value         = (int)this.waveDisplayUserControl1.MaxResolution;

            StartPositionTrackBar.Maximum       = (int)this.waveDisplayUserControl1.NumberOfSamples;
            StartPositionTrackBar.TickFrequency = StartPositionTrackBar.Maximum / 10;
            StartPositionTrackBar.Value         = 0;

            this.waveDisplayUserControl1.Resolution = (int)this.waveDisplayUserControl1.MaxResolution;
            this.waveDisplayUserControl1.SetAudioData(host.RecordedLeft.ToArray());
        }
        void ProcessAudioBtnClick(object sender, EventArgs e)
        {
            // plugin does not support processing audio
            if ((PluginContext.PluginInfo.Flags & VstPluginFlags.CanReplacing) == 0)
            {
                MessageBox.Show(this, "This plugin does not process any audio.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            VstHost host = VstHost.Instance;

            host.PluginContext = this.PluginContext;
            if (waveInputFilePath != "")
            {
                host.InputWave = waveInputFilePath;
                // with iblock=1...Nblocks and blocksize = Fs * tblock. Fs = 44100 and
                // tblock = 0.15 makes blocksize = 6615.
                int sampleRate = 44100;
                int blockSize  = (int)(sampleRate * 0.15f);                 //6615;
                int channels   = 2;
                host.Init(blockSize, sampleRate, channels);

                if (playback == null)
                {
                    playback = new VstPlaybackNAudio(host);
                    playback.Play();
                }
                else
                {
                    // toogle start or stop
                    if (playback.PlaybackDevice.PlaybackState == PlaybackState.Playing)
                    {
                        playback.Stop();
                    }
                    else if (playback.PlaybackDevice.PlaybackState == PlaybackState.Stopped)
                    {
                        playback.Play();
                    }
                }
            }
            else
            {
                MessageBox.Show(this, "Please choose an audio file to process.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
        static void StartVstHost(string pluginPath, string waveInputFilePath, string fxpFilePath, string waveOutputFilePath, bool doPlay)
        {
            VstHost host = VstHost.Instance;
            var     hcs  = new HostCommandStub();

            host.OpenPlugin(pluginPath, hcs);
            host.InputWave = waveInputFilePath;

            // with iblock=1...Nblocks and blocksize = Fs * tblock. Fs = 44100 and
            // tblock = 0.15 makes blocksize = 6615.
            const int sampleRate = 44100;
            const int blockSize  = 8192;
            const int channels   = 2;

            host.Init(blockSize, sampleRate, channels);
            System.Diagnostics.Debug.WriteLine(host.getPluginInfo());
            host.LoadFXP(fxpFilePath);

            if (doPlay)
            {
                var playback = new VstPlaybackNAudio(host);
                playback.Play();

                Console.WriteLine("Started Audio Playback");

                // make sure to play while the stream is playing
                if (playback.PlaybackDevice.PlaybackState == PlaybackState.Playing)
                {
                    Thread.Sleep(5000);
                }

                Console.WriteLine("Ending Audio Playback");
                playback.Stop();
                Console.WriteLine("Stopped Audio Playback");
                playback.Dispose();
            }

            if (waveOutputFilePath != "")
            {
                var fileWriter = new VstFileWriter(host);
                fileWriter.CreateWaveFile(waveOutputFilePath);
            }
        }
Exemple #28
0
        void MidiNoteCheckboxCheckedChanged(object sender, EventArgs e)
        {
            VstHost host = VstHost.Instance;

            host.PluginContext = this.PluginContext;
            host.doPluginOpen();

            InitPlayback();
            Playback.Play();

            var check = (CheckBox)sender;

            if (check.Checked)
            {
                host.SendMidiNote(host.SendContinousMidiNote, host.SendContinousMidiNoteVelocity);
            }
            else
            {
                host.SendMidiNote(host.SendContinousMidiNote, 0);
            }
        }
        void CropBtnClick(object sender, EventArgs e)
        {
            VstHost host = VstHost.Instance;

            // crop the audio at silence
            float[] data = AudioUtils.CropAudioAtSilence(host.RecordedLeft.ToArray(), 0, false, 0);

            host.RecordedLeft.Clear();
            host.RecordedLeft.AddRange(data);

            MaxResolutionTrackBar.Maximum       = (int)this.waveDisplayUserControl1.MaxResolution;
            MaxResolutionTrackBar.TickFrequency = MaxResolutionTrackBar.Maximum / 10;
            MaxResolutionTrackBar.Value         = (int)this.waveDisplayUserControl1.MaxResolution;

            StartPositionTrackBar.Maximum       = (int)this.waveDisplayUserControl1.NumberOfSamples;
            StartPositionTrackBar.TickFrequency = StartPositionTrackBar.Maximum / 10;
            StartPositionTrackBar.Value         = 0;

            this.waveDisplayUserControl1.Resolution = (int)this.waveDisplayUserControl1.MaxResolution;
            this.waveDisplayUserControl1.SetAudioData(host.RecordedLeft.ToArray());
        }
        void MeasureModEnvelopeInit()
        {
            VstHost host = VstHost.Instance;

            host.PluginContext = this.PluginContext;
            host.doPluginOpen();
            SetupAudio(host);

            // init
            ((HostCommandStub)PluginContext.HostCommandStub).DoInvestigatePluginPresetFileFormat = true;

            // Sylenth (Mod Env Attack and Decay):
            // Init:
            // AMP ENV A: A = 0, D = 0, R = 0, S = max (10)
            // Mix A and Mix B = 0
            // Master (Main Volume) = half (5)
            // Mod Env A destination: "Mix AB"
            // Mod Env A destination amount (ModEnv1Dest1Am): max (10)
            // Mod Env A: A = 0, D = 0; R = 0, S = 0
            // Then step through the A and D steps and measure

            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_MAIN_VOLUME, 0.5f);
            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_MIX_A, 0.0f);
            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_MIX_B, 0.0f);

            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_AMP_ENV1_ATTACK, 0.0f);
            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_AMP_ENV1_DECAY, 0.0f);
            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_AMP_ENV1_SUSTAIN, 1.0f);
            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_AMP_ENV1_RELEASE, 0.0f);

            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_MOD_ENV1_ATTACK, 0.0f);
            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_MOD_ENV1_DECAY, 0.0f);
            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_MOD_ENV1_SUSTAIN, 0.0f);
            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_MOD_ENV1_RELEASE, 0.0f);

            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_YMOD_ENV1_DEST1,
                                                         PresetConverter.Sylenth1Preset.EnumUintToFloat(
                                                             (uint)PresetConverter.Sylenth1Preset.YMODDEST.Mix_AB));
            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_XMOD_ENV1_DEST1AMOUNT, 1.0f);
        }
        // -----------------------------------
        // Automatic measurement methods
        // Currently support auto-measurment of the following
        // Amplitude Envelopes: A D and R
        // Modulation Envelopes: A D and R
        // LFO
        // -----------------------------------

        // How to measure Amplitude Envelopes:

        // Sylenth (Amplitude Env Attack, Decay and Release)
        // Init:
        // AMP ENV A: A = 0, D = 0, S = 0, R = 0
        // Then step through the A, D and R steps and measure
        // Attack: for (float paramValue = 1.0f; paramValue >= 0.0f; paramValue -= 0.020f)
        // Decay: for (float paramValue = 1.0f; paramValue >= 0.0f; paramValue -= 0.020f)

        // For Release you have to make sure the Sustain is full.
        // Then send a short midi message and measure the length of the tail
        // Release: for (float paramValue = 1.0f; paramValue >= 0.0f; paramValue -= 0.020f)


        // How to measure Modulation Envelopes:

        // Sylenth (Mod Env Attack and Decay):
        // Init:
        // AMP ENV A: A = 0, D = 0, R = 0, S = max (10)
        // Mix A and Mix B = 0
        // Master (Main Volume) = half (5)
        // Mod Env A destination: "Mix AB"
        // Mod Env A destination amount (ModEnv1Dest1Am): max (10)
        // Mod Env A: A = 0, D = 0; R = 0, S = 0
        // Then step through the A and D steps and measure


        // How to measure LFO:

        // Sylenth:
        // Init:
        // AMP ENV A: A = 0, D = 0, S = 0, R = 0
        // LFO Gain = Max (1)
        // LFO Rate = Min (0)
        // LFO Wave = LFO_Pulse
        // OSC VOL = Half (0.5)
        // OSC Wave = OSC_Pulse
        // SYLENTH_PARAM_XMODLFO1DEST1AMOUNT = Max (1)
        // SYLENTH_PARAM_YMODLFO1DEST1 = YMODDEST.VolumeAB
        // Then through the LFO steps and measure
        // for (float paramValue = 1.0f; paramValue >= 0.0f; paramValue -= 0.020f)

        void MeasureAmpEnvelopeInit()
        {
            VstHost host = VstHost.Instance;

            host.PluginContext = this.PluginContext;
            host.doPluginOpen();
            SetupAudio(host);

            // init
            ((HostCommandStub)PluginContext.HostCommandStub).DoInvestigatePluginPresetFileFormat = true;

            // Sylenth (Amplitude Env Attack, Decay and Release)
            // Init:
            // AMP ENV A: A = 0, D = 0, S = 0, R = 0
            // Then step through the A, D and R steps and measure
            // Attack: for (float paramValue = 1.0f; paramValue >= 0.0f; paramValue -= 0.020f)
            // Decay: for (float paramValue = 1.0f; paramValue >= 0.0f; paramValue -= 0.020f)
            // Release: for (float paramValue = 1.0f; paramValue >= 0.0f; paramValue -= 0.020f)

            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_MAIN_VOLUME, 0.5f);
            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_MIX_A, 0.5f);
            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_MIX_B, 0.5f);

            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_AMP_ENV1_ATTACK, 0.0f);
            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_AMP_ENV1_DECAY, 0.0f);
            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_AMP_ENV1_SUSTAIN, 0.0f);
            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_AMP_ENV1_RELEASE, 0.0f);

            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_YMOD_ENV1_DEST1,
                                                         PresetConverter.Sylenth1Preset.EnumUintToFloat(
                                                             (uint)PresetConverter.Sylenth1Preset.YMODDEST.None));
            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_XMOD_ENV1_DEST1AMOUNT, 0.0f);

            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_YMOD_LFO1_DEST1,
                                                         PresetConverter.Sylenth1Preset.EnumUintToFloat(
                                                             (uint)PresetConverter.Sylenth1Preset.YMODDEST.None));
            PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_XMOD_LFO1_DEST1AMOUNT, 0.0f);
        }
 /// <summary>
 /// Called by the client when done with edit.
 /// </summary>
 public void Dispose()
 {
     if (host != null)
     {
         host.HostCommandStub.EndEdit(index);
         host = null;
     }
 }
            public FileSelectorScope(VstHost host, VstFileSelect fileSelect)
            {
                this.host = host;
                this.fileSelect = fileSelect;

                if (host.HostCommandStub.OpenFileSelector(fileSelect) == false)
                    throw new InvalidOperationException(Resources.FileSelectorScope_OpenNotSupported);
            }
 /// <summary>
 /// Call by the client when it is done with the file selector.
 /// </summary>
 /// <remarks>We do not check wheter or not the host supports closing the file selector...</remarks>
 public void Dispose()
 {
     if (host != null)
     {
         host.HostCommandStub.CloseFileSelector(fileSelect);
         host = null;
     }
 }
        /// <summary>
        /// Constructs a new instance based on a root <paramref name="host"/> object.
        /// </summary>
        /// <param name="host">Must not be null.</param>
        /// <exception cref="System.ArgumentNullException">Thrown when <paramref name="host"/> is not set to an instance of an object.</exception>
        public VstHostSequencer(VstHost host)
        {
            Throw.IfArgumentIsNull(host, "host");

            this.host = host;
        }
        /// <summary>
        /// Constructs an instance on the host proxy.
        /// </summary>
        /// <param name="host">Must not be null.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="host"/> is not set to an instance of an object.</exception>
        public VstHostOfflineProcessor(VstHost host)
        {
            Throw.IfArgumentIsNull(host, "host");

            this.host = host;
        }
        /// <summary>
        /// Constructs an instance on the host proxy.
        /// </summary>
        /// <param name="host">Must not be null.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="host"/> is not set to an instance of an object.</exception>
        public VstHostAutomation(VstHost host)
        {
            Throw.IfArgumentIsNull(host, "host");

            this.host = host;
        }
 public EditParameterScope(VstHost host, int index)
 {
     this.host = host;
     this.index = index;
 }