private void RebuildEnvInt(int points, int a, int d, int s, int r, int curv)
        {
            int l = points;

            if (points == -1)
            {
                l = Math.Min(4000, pictureBox1.Width);
            }

            Envelope Envelope2 = new Envelope();

            TestFrameLoader.ResetStatic();
            for (int i = 0; i < l; i++)
            {
                if (i == 0)
                {
                    Envelope2.TriggerOn(); TestFrameLoader.Trigger(1, 1, (int)EnvMode);
                }
                if (i == (points * 2) / 4)
                {
                    Envelope2.TriggerOff(EnvMode); TestFrameLoader.Trigger(0, 1, (int)EnvMode);
                }

                double D = 0;
                triggers2[i]  = Envelope2.Trigger;
                values2[i]    = TestFrameLoader.GetEnv(1, a * 255, d * 255, s * 255, r * 255, curv * 255, (int)TimeScale, (int)EnvMode) / 4095.0;
                D             = TestFrameLoader.GetEnvCurve(1) / 4095.0;
                linvalues2[i] = D;
            }
        }
        private void RebuildEnv(int points = -1)
        {
            int l = points;

            if (points == -1)
            {
                l = Math.Min(4000, pictureBox1.Width);
            }

            Envelope Envelope2 = new Envelope();

            TestFrameLoader.ResetStatic();
            for (int i = 0; i < l; i++)
            {
                if (i == 10)
                {
                    Envelope2.TriggerOn(); TestFrameLoader.Trigger(1, 1, (int)EnvMode);
                }
                if (i == 210)
                {
                    Envelope2.TriggerOff(EnvMode); TestFrameLoader.Trigger(0, 1, (int)EnvMode);
                }

                double D = 0;
                triggers2[i]  = Envelope2.Trigger;
                values2[i]    = TestFrameLoader.GetEnv(1, Attack.Value * 255, Decay.Value * 255, Sustain.Value * 255, Release.Value * 255, Curvature.Value * 255, (int)TimeScale, (int)EnvMode) / 4095.0;
                D             = TestFrameLoader.GetEnvCurve(1) / 4095.0;
                linvalues2[i] = D;
            }
        }
        private void EnvUpdate_Tick(object sender, EventArgs e)
        {
            for (int i = 0; i < 10; i++)
            {
                pos = (pos + 1) % 4000;
                double D = 0;
                triggers[pos] = Envelope.Trigger;
                values[pos]   = TestFrameLoader.GetEnv(0, Attack.Value * 255, Decay.Value * 255, Sustain.Value * 255, Release.Value * 255, Curvature.Value * 255, (int)TimeScale, (int)EnvMode) / 4095.0;
                D             = TestFrameLoader.GetEnvCurve(0) / 4095.0;

                linvalues[pos] = D;
            }
        }