public void ProcessSample(double[][] input, double[][] output, uint bufferSize) { double[] inBuffer = input[0]; double[] outBufferL = output[0]; double[] outBufferR = output[1]; var inputGain = 0.4; // make input signal strength closer to that of a guitar pickup voltage var gain = Utils.ExpResponse(ParameterInfo[P_GAIN].Value) * inputGain; var volume = Utils.ExpResponse(ParameterInfo[P_VOLUME].Value); var GainInv = 2.2 / 1000.0; HpInput.ProcessInPlace(inBuffer); Utils.GainInPlace(inBuffer, gain); TFStage.ProcessInPlace(inBuffer); var diodeOutput = DiodeStage.GetValues(inBuffer); LowpassFilter.ProcessInPlace(diodeOutput); // sum the diode response to the clean component with gain adjustment for clean for (int i = 0; i < diodeOutput.Length; i++) { diodeOutput[i] = diodeOutput[i] + GainInv * inBuffer[i]; } HpOutput.ProcessInPlace(diodeOutput); Utils.GainInPlace(diodeOutput, volume); for (int i = 0; i < diodeOutput.Length; i++) { outBufferL[i] = diodeOutput[i]; outBufferR[i] = diodeOutput[i]; } }
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); //if (ParameterInfo[P_LEDs].Value < 0.5) //{ Clipper.GetValuesInPlace(temp); /*} * else * { * ClipperLED.GetValuesInPlace(temp); * Utils.GainInPlace(temp, 0.6); * }*/ Tonestack.ProcessInPlace(temp); TF2.ProcessInPlace(temp); Contour.ProcessInPlace(temp); OutHP.ProcessInPlace(temp); OutLP.ProcessInPlace(temp); Utils.GainInPlace(temp, Utils.ExpResponse(ParameterInfo[P_VOLUME].Value)); // copy data to outBuffer for (int i = 0; i < input[0].Length; i++) { outBuffer[i] = temp[i]; outBuffer2[i] = temp[i]; } }
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]; } }
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]; } } }