Exemple #1
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
        }
        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 #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);
            }
        }
Exemple #4
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 #5
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 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);
        }
        void PlayMidiC5100msBtnClick(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();
            }

            // 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);
        }