public override float Process(int theChannel, float signal, float theTime) { _myChannels = CCMath.Max(_myChannels, theChannel + 1); // Debug.Log(_myChannels + " " + input.Length); // make sure we have enough filter buffers if (input == null || input.Length != _myChannels || (input[theChannel].Length < a.Length && input[theChannel].Length < b.Length)) { InitArrays(); } // apply the filter to the sample value in each channel Array.Copy(input[theChannel], 0, input[theChannel], 1, input[theChannel].Length - 1); input[theChannel][0] = signal; float y = 0; for (int ci = 0; ci < a.Length; ci++) { y += a[ci] * input[theChannel][ci]; } for (int ci = 0; ci < b.Length; ci++) { y += b[ci] * output[theChannel][ci]; } Array.Copy(output[theChannel], 0, output[theChannel], 1, output[theChannel].Length - 1); if (double.IsNaN(y)) { y = 0; } output[theChannel][0] = y; if (bypass) { return(signal); } return(y); }
public override int NumberOfSegments() { return(CCMath.Max(_mySpline1.NumberOfSegments(), _mySpline2.NumberOfSegments())); }