/// <summary> Slowest Backup Alternative for calculating RMS </summary> public static double CalculateRMS(this IAnalyticStream stream) { if (stream.Samples == 0) { return(0.0); } if (stream.Samples == int.MaxValue) { return(double.NaN); } double rms = 0.0; int readSamples; const int BUFFER_SIZE = 512; Complex64[] buffer = new Complex64[BUFFER_SIZE]; stream.Reset(); do { readSamples = stream.Read(buffer, 0, BUFFER_SIZE); for (int i = 0; i < readSamples; i++) { rms += buffer[i].Real * buffer[i].Real; } }while (readSamples > 0); stream.Reset(); return(Math.Sqrt(rms / stream.Samples)); }
public void Reset() => stream.Reset();
public override void Reset() => stream.Reset();