/// <summary> /// Now uses a Mutex object around all the processing, so that updates of /// properties or fields do NOT occur while a block is being processed. /// (George Byrkit, 4 January 2012) /// </summary> /// <param name="inbuffer">input buffer, a complex (CPX) array</param> /// <param name="outbuffer">output buffer, a complex (CPX) array</param> unsafe public void DoDSPProcess(ref CPX[] inbuffer, ref CPX[] outbuffer) { try { ReceiverMutex.WaitOne(); rxbuffer.Fill(ref inbuffer); #region Do Noiseblankers if (block_noise_blanker.BlockNBSwitchOn) { block_noise_blanker.Process(); } if (ave_noise_blanker.AveNBSwitchOn) { ave_noise_blanker.Process(); } #endregion #region Local Oscillator local_osc.Process(); #endregion #region Power Spectrum before filter power_spectrum.Process(); //djm uncommented #endregion #region Filter filter.Process(); #endregion #region Metering after filter meter.Process(); #endregion #region Do AGC #if false // find max real and imaginary components for warren and log them (using OutputDebugString) float maxReal = 0.0F; float maxImaginary = 0.0F; float temp; for (int i = 0; i < rxbuffer.State.DSPBlockSize; ++i) { temp = Math.Abs(rxbuffer.cpx[i].real); if (temp > maxReal) { maxReal = temp; } temp = Math.Abs(rxbuffer.cpx[i].imag); if (temp > maxImaginary) { maxImaginary = temp; } } string logMsg = String.Format("AGC Buffer max real = {0}, max imaginary = {1}\n", maxReal, maxImaginary); OutputDebugString(logMsg); //Console.Write(logMsg); #endif agc.Process(); #endregion #region Squelch squelch.Process(); #endregion #region Do Demod pll.Process(); #endregion if (noise_filter.NoiseFilterSwitchOn) { noise_filter.Process(); } if (interference_filter.InterferenceFilterSwitchOn) { interference_filter.Process(); } #region Do Output output_mode.Process(); #endregion outbuffer = (CPX[])rxbuffer.cpx.Clone(); } finally { ReceiverMutex.ReleaseMutex(); } }
unsafe public void DoDSPProcess(ref CPX[] inbuffer, ref CPX[] outbuffer) { rxbuffer.Fill(ref inbuffer); #region Do Noiseblankers if (block_noise_blanker.BlockNBSwitchOn) { block_noise_blanker.Process(); } if (ave_noise_blanker.AveNBSwitchOn) { ave_noise_blanker.Process(); } #endregion #region Local Oscillator local_osc.Process(); #endregion #region Power Spectrum before filter power_spectrum.Process(); //djm uncommented #endregion #region Filter filter.Process(); #endregion #region Metering after filter meter.Process(); #endregion #region Do AGC agc.Process(); #endregion #region Squelch squelch.Process(); #endregion #region Do Demod pll.Process(); #endregion if (noise_filter.NoiseFilterSwitchOn) { noise_filter.Process(); } if (interference_filter.InterferenceFilterSwitchOn) { interference_filter.Process(); } #region Do Output output_mode.Process(); #endregion outbuffer = (CPX[])rxbuffer.cpx.Clone(); }