public void ProcessSample(double[][] input, double[][] output, uint bufferSize) { double[] inBuffer = input[0]; double[] outBufferL = output[0]; double[] outBufferR = 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] = gainStage.Compute(hp.Process(inBuffer[i]) * 20); temp[i] = lp.Process(temp[i]); } for (int i = 0; i < input[0].Length; i++) { outBufferL[i] = temp[i] * ParameterInfo[P_VOL].Value; outBufferR[i] = temp[i] * ParameterInfo[P_VOL].Value; } }
public void Process(double[] input, int sampleCount) { int len = sampleCount; var predelayOutput = preDelay.Output; var lowPassInput = highPassEnabled ? tempBuffer : input; if (highPassEnabled) { highPass.Process(input, tempBuffer, len); } if (lowPassEnabled) { lowPass.Process(lowPassInput, tempBuffer, len); } if (!lowPassEnabled && !highPassEnabled) { input.Copy(tempBuffer, len); } // completely zero if no input present // Previously, the very small values were causing some really strange CPU spikes for (int i = 0; i < len; i++) { var n = tempBuffer[i]; if (n * n < 0.000000001) { tempBuffer[i] = 0; } } preDelay.Process(tempBuffer, len); multitap.Process(preDelay.Output, len); var earlyOutStage = diffuserEnabled ? diffuser.Output : multitap.Output; if (diffuserEnabled) { diffuser.Process(multitap.Output, len); diffuser.Output.Copy(tempBuffer, len); } else { multitap.Output.Copy(tempBuffer, len); } for (int i = 0; i < lineCount; i++) { lines[i].Process(tempBuffer, len); } for (int i = 0; i < lineCount; i++) { var buf = lines[i].Output; if (i == 0) { for (int j = 0; j < len; j++) { tempBuffer[j] = buf[j]; } } else { for (int j = 0; j < len; j++) { tempBuffer[j] += buf[j]; } } } tempBuffer.Gain(perLineGain, len); for (int i = 0; i < len; i++) { outBuffer[i] = dryOut * input[i] + predelayOut * predelayOutput[i] + earlyOut * earlyOutStage[i] + lineOut * tempBuffer[i]; } }