private unsafe static int AirSpyHFSamplesAvailable(airspyhf_transfer *data) { int length = data->sample_count; Complex *samples = data->samples; ulong num = data->dropped_samples; IntPtr ctx = data->ctx; GCHandle gCHandle = GCHandle.FromIntPtr(ctx); if (!gCHandle.IsAllocated) { return(-1); } AirspyHFDevice airspyHFDevice = (AirspyHFDevice)gCHandle.Target; if (airspyHFDevice._decimationStages > 0) { int num2 = 1 << airspyHFDevice._decimationStages; if (airspyHFDevice._ddc == null || airspyHFDevice._ddc.DecimationRatio != num2) { airspyHFDevice._ddc = new DownConverter((double)airspyHFDevice._deviceSampleRate, num2); } airspyHFDevice._ddc.Frequency = airspyHFDevice._ifShift; length = airspyHFDevice._ddc.Process(samples, length); num >>= airspyHFDevice._decimationStages; } airspyHFDevice.OnComplexSamplesAvailable(samples, length, num); return(0); }
public void Open() { this._device = new AirspyHFDevice(); this._device.DecimationStages = this._decimationStages; this._device.Frequency = (uint)this._frequency; this._gui.Device = this._device; this._device.SamplesAvailable += this.Device_SamplesAvailable; }
public void Close() { if (this._device != null) { this._gui.Device = null; this._device.SamplesAvailable -= this.Device_SamplesAvailable; this._device.Dispose(); this._device = null; } }