public void ProcessSample(double[][] input, double[][] output, uint bufferSize)
        {
            double[] inBuffer   = input[0];
            double[] outBuffer  = output[0];
            double[] outBuffer2 = output[1];

            // Double buffer for tonestack to work on
            double[] temp = new double[inBuffer.Length];

            for (int i = 0; i < inBuffer.Length; i++)
            {
                temp[i] = inBuffer[i];
            }

            Hp1.ProcessInPlace(temp);
            LpNoise.ProcessInPlace(temp);
            GainTF.ProcessInPlace(temp);
            PostGain.ProcessInPlace(temp);
            Utils.GainInPlace(temp, 83);
            Utils.SaturateInPlace(temp, 4);
            SaturateLP.ProcessInPlace(temp);
            ClipperHP.ProcessInPlace(temp);
            Clipper.ProcessInPlace(temp);

            Tonestack.ProcessInPlace(temp);
            TF2.ProcessInPlace(temp);
            Contour.ProcessInPlace(temp);
            OutHP.ProcessInPlace(temp);
            OutLP.ProcessInPlace(temp);
            Utils.GainInPlace(temp, Utils.ExpResponse(ParameterInfo[P_VOLUME].Value));

            for (int i = 0; i < input[0].Length; i++)
            {
                outBuffer[i]  = temp[i];
                outBuffer2[i] = temp[i];
            }
        }
示例#2
0
        public void ProcessSample(double[][] input, double[][] output, uint bufferSize)
        {
            double[] signal = input[0];
            HighpassInput.ProcessInPlace(signal);

            // Channel A
            if (ParameterInfo[P_CHANNEL].Value <= 0.5)
            {
                var inputGain = Utils.ExpResponse(ParameterInfo[P_INPUT_A].Value);
                Utils.GainInPlace(signal, inputGain);

                TF1A.ProcessInPlace(signal);
                Stage1A.ProcessInPlace(signal);

                TF2A.ProcessInPlace(signal);
                Stage2A.ProcessInPlace(signal);

                var volume = Utils.ExpResponse(ParameterInfo[P_VOL_A].Value) * 0.333;                 // match loudness of channels
                Utils.GainInPlace(signal, volume);

                PostVolumeHpA.ProcessInPlace(signal);
                TonestackA.ProcessInPlace(signal);
                TFPresA.ProcessInPlace(signal);
            }

            // Channel B
            if (ParameterInfo[P_CHANNEL].Value > 0.5f)
            {
                var inputGain = Utils.ExpResponse(ParameterInfo[P_INPUT_B].Value) * 5;
                Utils.GainInPlace(signal, inputGain);

                TF1B.ProcessInPlace(signal);
                TF1xB.ProcessInPlace(signal);

                Stage1B.ProcessInPlace(signal);

                TF2B.ProcessInPlace(signal);
                Stage2B.ProcessInPlace(signal);

                hipassZenerB.ProcessInPlace(signal);
                ClipperZenerB.ProcessInPlace(signal);

                if (ParameterInfo[P_BOOST_B].Value > 0.5f)
                {
                    ClipperDiodeB.ProcessInPlace(signal);
                    Utils.GainInPlace(signal, 6);
                }

                TFVolumeB.ProcessInPlace(signal);
                TonestackB.ProcessInPlace(signal);
                TFPresB.ProcessInPlace(signal);
            }

            LowpassOutput.ProcessInPlace(signal);

            // prevent horrible noise in case something goes wrong
            Utils.SaturateInPlace(signal, -4, 4);

            // copy data to outBuffer
            for (int i = 0; i < bufferSize; i++)
            {
                output[0][i] = signal[i];
                output[1][i] = signal[i];
            }
        }
示例#3
0
        public void ProcessSample(double[][] input, double[][] output, uint bufferSize)
        {
            double[] inBuffer   = input[0];
            double[] outBuffer  = output[0];
            double[] outBuffer2 = output[1];

            if (signal == null || signal.Length != inBuffer.Length)
            {
                signal      = new double[inBuffer.Length];
                signalClean = new double[inBuffer.Length];
            }

            for (int i = 0; i < inBuffer.Length; i++)
            {
                signal[i] = inBuffer[i];
            }

            Hipass1.ProcessInPlace(signal);
            Utils.GainInPlace(signal, Utils.DB2gain(-3));
            Lowpass1.ProcessInPlace(signal);

            // Store undistorted signal, if we set mode to Overdrive then this signal is added to the distorted signal
            Array.Copy(signal, signalClean, signal.Length);

            Gain.ProcessInPlace(signal);
            // LM308 has a voltage swing of about +-4 volt, then it hard clips
            Utils.SaturateInPlace(signal, 4.0f);
            HipassDC.ProcessInPlace(signal);

            if (ParameterInfo[P_TURBO].Value >= 0.5)
            {
                Utils.SaturateInPlace(signal, 7.99f);
                Clipper2.ProcessInPlace(signal);                 // LEDs
                Utils.GainInPlace(signal, 0.7f);
            }
            else
            {
                Utils.SaturateInPlace(signal, 7.99f);
                Clipper.ProcessInPlace(signal);                 // Silicon
            }

            if (ParameterInfo[P_OD].Value > 0.5)
            {
                for (int i = 0; i < signal.Length; i++)
                {
                    signal[i] = 0.6f * signal[i] + 0.9f * signalClean[i];
                }
            }

            Filter.ProcessInPlace(signal);
            Hipass3.ProcessInPlace(signal);
            Utils.GainInPlace(signal, Utils.ExpResponse(ParameterInfo[P_VOL].Value));

            // copy data to outBuffer
            if (ParameterInfo[P_ON].Value < 0.5)
            {
                for (int i = 0; i < signal.Length; i++)
                {
                    outBuffer[i]  = inBuffer[i];
                    outBuffer2[i] = inBuffer[i];
                }
            }
            else
            {
                for (int i = 0; i < signal.Length; i++)
                {
                    outBuffer[i]  = (float)signal[i];
                    outBuffer2[i] = (float)signal[i];
                }
            }
        }