protected override void OnSettingsChanged(SettingsChangedEventArgs e) { if (settings.InputDataDimensions <= 0) { throw new ArgumentException("The dimensions of the moving average must be 1 or more.", "InputDataDimensions"); } valuesToAverage = new float[settings.InputDataDimensions][]; for (int j = 0; j < settings.InputDataDimensions; j++) { valuesToAverage[j] = new float[settings.MovingAverageLength]; } }
protected override void OnSettingsChanged(SettingsChangedEventArgs e) { valuesToMeasure = new float[settings.SampleCount]; }
protected override void OnSettingsChanged(SettingsChangedEventArgs e) { while (isProcessing) { Thread.Sleep(100); } int n = settings.FFTSampleCount; timeDomainData = new float[settings.FFTSampleCount]; frequencyDomainData = new float[settings.FFTSampleCount]; // n*2 because we are dealing with complex numbers complexInput = new float[n * 2]; complexOutput = new float[n * 2]; try { mfin = new fftwf_complexarray(complexInput); mfout = new fftwf_complexarray(complexOutput); } catch (DllNotFoundException) { Console.WriteLine("DllNotFoundException: You must copy the native FFTW DLLs (libfftw3-3.dll, libfftw3f-3.dll, libfftw3l-3.dll) into the working directory."); throw; } catch (BadImageFormatException) { Console.WriteLine("BadImageFormatException: This normally means, that you're loading a 32bit DLL into a 64bit process or vice versa."); throw; } plan = fftwf_plan.dft_1d(n, mfin, mfout, settings.IsBackward ? fftw_direction.Backward : fftw_direction.Forward, settings.PlanningRigor == FFTPlanningRigor.Estimate ? fftw_flags.Estimate : settings.PlanningRigor == FFTPlanningRigor.Measure ? fftw_flags.Measure : settings.PlanningRigor == FFTPlanningRigor.Patient ? fftw_flags.Patient : fftw_flags.Estimate); switch (settings.OutputFormat) { case FFTOutputFormat.Raw: this.OutputBlockSize = settings.FFTSampleCount * 2; break; case FFTOutputFormat.RealImaginaryPair: this.OutputBlockSize = settings.FFTSampleCount; break; case FFTOutputFormat.RealOnly: this.OutputBlockSize = settings.FFTSampleCount / 2; break; case FFTOutputFormat.Magnitude: this.OutputBlockSize = settings.FFTSampleCount / 2; break; case FFTOutputFormat.FrequencyMagnitudePair: this.OutputBlockSize = settings.FFTSampleCount; break; default: throw new ArgumentException("The FFT's output format is not supported.", "FFTOutputFormat"); } }
protected virtual void OnSettingsChanged(SettingsChangedEventArgs e) { SettingsChanged?.Invoke(this, e); }