コード例 #1
0
ファイル: CicManager.cs プロジェクト: rotshtein/SatManager
        internal void StartConfiguration()
        {
            _token = new CancellationTokenSource();

            DownConverter.OnDownConverterConfigurationUpdateReceived += (sender, args) =>
            {
                OnConfigurationUpdated(this, args);
                if (args.Success)
                {
                    Task.Run(() => CicDecoderHandler.ConfigureCarrier(CarrierInformation));
                }
            };

            Decoder.OnCarrierConfigurationUpdateReceived += (sender, args) =>
            {
                OnConfigurationUpdated(this, args);
                if (args.Success)
                {
                    switch (args.Code)
                    {
                    case CicManagerConfigurationCode.CicDecoderCarrierConfiguration:
                        Task.Run(() => CicDecoderHandler.DetectCarrier());
                        break;

                    case CicManagerConfigurationCode.CicDecoderCarrierParametersDetection:
                        Task.Run(() => CicDecoderHandler.StartCarrierProduction());
                        break;

                    case CicManagerConfigurationCode.CicDecoderProductionStart:
                        Task.Run(() => CicDecoderHandler.ConfigureMediatorSoftware());
                        break;
                    }
                }
            };

            Decoder.OnMediationSoftwareConfigurationUpdateReceived += (sender, args) =>
            {
                OnConfigurationUpdated(this, args);
                if (args.Success)
                {
                    switch (args.Code)
                    {
                    case CicManagerConfigurationCode.MediationSofwareConfiguration:
                        Task.Run(() => CicDecoderHandler.DetectCicData());
                        break;

                    case CicManagerConfigurationCode.MediattionSoftwareParametersDetection:
                        Task.Run(() => CicDecoderHandler.StartDataProduction());
                        break;
                    }
                }
            };

            Task.Run(() => DownConverter.ConfigureCarrier(CarrierInformation));
        }
コード例 #2
0
        public ViewGenerator(SavedViewData info, int bufferSize, float sampleRate)
        {
            //Set
            this.info       = info;
            this.bufferSize = bufferSize;

            //Configure offset
            mutator            = new DownConverter(1);
            mutator.SampleRate = sampleRate;
            mutator.Frequency  = info.offset;

            //Configure decimator
            decimator   = new ComplexDecimator(sampleRate, sampleRate / info.decimation, (int)info.decimation);
            sampleRate /= info.decimation;

            //Get component list and image size
            components = info.CreateComponents(sampleRate, out width, out height);

            //Find out what workers are required
            foreach (var c in components)
            {
                fftRequired         = fftRequired || c.RequiresFft;
                demodulatorRequired = demodulatorRequired || c.RequiresAudio;
            }

            //Create these workers
            if (fftRequired)
            {
                fft = new FFTProcessorComplex(info.fftSize);
            }
            if (demodulatorRequired)
            {
                //Set up decimator
                audioDecimationRate = DecimationUtil.CalculateDecimationRate(sampleRate, info.audioBandwidth, out audioOutputRate);
                audioDecimator      = new ComplexDecimator(sampleRate, info.audioBandwidth, audioDecimationRate);

                //Set up demodulator
                demodulator = new WbFmDemodulator();
                demodulator.Configure(bufferSize, audioOutputRate);
            }

            //Initialize all
            foreach (var c in components)
            {
                c.Init(info, fft, demodulator);
            }

            //Create buffers
            iqBuffer = UnsafeBuffer.Create(bufferSize, sizeof(Complex));
            iqPtr    = (Complex *)iqBuffer;
        }
コード例 #3
0
ファイル: AirspyDevice.cs プロジェクト: yi520520/SDRSharp-1
        private void UpdateDDC()
        {
            int num = 1 << this._decimationStages;

            if (this._ddc != null && this._ddc.DecimationRatio == num && this._ddc.SampleRate == (double)this._sampleRate)
            {
                return;
            }
            this._ddc = new DownConverter((double)this._sampleRate, num);
            AnalogFilterConfig analogFilterConfig = this._analogFilterConfig;

            if (analogFilterConfig != null)
            {
                this._ddc.Frequency = (double)analogFilterConfig.Shift;
            }
        }