public unsafe void Process(Complex *buffer, int length) { if (this._resetNeeded) { this._pll.Reset(); this._resetNeeded = false; } for (int i = 0; i < length; i++) { Complex b = Complex.FromAngleFast(this._pll.Phase); Complex *intPtr = buffer + i; * intPtr *= b; Complex complex = buffer[i]; if (this._pll.StickOnFrequencyIfNotLocked || this._pll.IsLocked) { this._iavg += this._alpha * (complex.Real - this._iavg); this._qavg += this._alpha * (complex.Imag - this._qavg); complex.Real = this._iavg; complex.Imag = this._qavg; this._pll.StickOnFrequencyIfNotLocked = true; if (this._pll.IsLocked) { this._unlockedCount = 0; } else if (++this._unlockedCount > this._maxUnlockedTicks) { this._pll.StickOnFrequencyIfNotLocked = false; this._unlockedCount = 0; } } complex *= b.Conjugate(); this._pll.Process(complex); } }