public void OpenSoundDevice(int inputDevice, int outputDevice, double inputSampleRate, int bufferSizeInMs) { this.Stop(); this._inputType = InputType.SoundCard; this._inputDevice = inputDevice; this._outputDevice = outputDevice; this._inputSampleRate = inputSampleRate; this._inputBufferSize = (int)((double)bufferSizeInMs * this._inputSampleRate / 1000.0); if (this._inputDevice == this._outputDevice) { this._decimationStageCount = 0; this._outputSampleRate = this._inputSampleRate; this._outputBufferSize = this._inputBufferSize * 2; } else { this._decimationStageCount = StreamControl.GetDecimationStageCount(this._inputSampleRate, DetectorType.AM); int num = 1 << this._decimationStageCount; int num2 = num * StreamControl._bufferAlignment; this._inputBufferSize = this._inputBufferSize / num2 * num2; this._outputSampleRate = this._inputSampleRate / (double)num; this._outputBufferSize = this._inputBufferSize / num * 2; } this._bufferSizeInMs = (double)this._inputBufferSize / this._inputSampleRate * 1000.0; }
public void OpenPlugin(IFrontendController frontend, int outputDevice, int bufferSizeInMs) { this.Stop(); try { this._inputType = InputType.Plugin; this._frontend = frontend; if (frontend is IIQStreamController) { this._inputSampleRate = ((IIQStreamController)this._frontend).Samplerate; this._outputDevice = outputDevice; this._inputBufferSize = (int)((double)bufferSizeInMs * this._inputSampleRate / 1000.0); if (this._inputBufferSize == 0) { throw new ArgumentException("The source '" + this._frontend + "' is not ready"); } this._decimationStageCount = StreamControl.GetDecimationStageCount(this._inputSampleRate, DetectorType.AM); int num = 1 << this._decimationStageCount; int num2 = num * StreamControl._bufferAlignment; this._inputBufferSize = this._inputBufferSize / num2 * num2; this._outputSampleRate = this._inputSampleRate / (double)num; this._outputBufferSize = this._inputBufferSize / num * 2; this._bufferSizeInMs = (double)this._inputBufferSize / this._inputSampleRate * 1000.0; goto end_IL_0006; } throw new ArgumentException("The source '" + this._frontend + "' is not ready"); end_IL_0006 :; } catch { this.Stop(); throw; } }
private void Configure(bool refreshOnly = true) { if (this._sampleRate != 0.0) { this._actualDetectorType = this._detectorType; bool refresh = false; this._baseBandDecimationStageCount = StreamControl.GetDecimationStageCount(this._sampleRate, this._actualDetectorType); this._audioDecimationStageCount = this._decimationStageCount - this._baseBandDecimationStageCount; int num = 1 << this._baseBandDecimationStageCount; double num2 = this._sampleRate / (double)num; if (!refreshOnly || this._mainDownConverter == null || this._mainDownConverter.SampleRate != this._sampleRate || this._mainDownConverter.DecimationRatio != num) { this._mainDownConverter = new DownConverter(this._sampleRate, num); refresh = true; this.ConfigureHookSampleRates(); } this._mainDownConverter.Frequency = (double)this._frequency; if (!refreshOnly || this._ifOffsetTranslator == null || this._ifOffsetTranslator.SampleRate != num2) { this._ifOffsetTranslator = new FrequencyTranslator(num2); } this._ifOffsetTranslator.Frequency = (double)(-this._ifOffset); this.UpdateFilters(refresh); this._carrierLocker.SampleRate = num2; this._cwDetector.SampleRate = num2; this._fmDetector.SampleRate = num2; this._fmDetector.SquelchThreshold = this._squelchThreshold; this._amDetector.SquelchThreshold = this._squelchThreshold; this._stereoDecoder.Configure(this._fmDetector.SampleRate, this._audioDecimationStageCount); this._rdsDecoder.SampleRate = this._fmDetector.SampleRate; this._stereoDecoder.ForceMono = !this._fmStereo; switch (this._actualDetectorType) { case DetectorType.CW: this._cwDetector.BfoFrequency = this._cwToneShift; break; case DetectorType.NFM: this._fmDetector.Mode = FmMode.Narrow; break; case DetectorType.WFM: this._fmDetector.Mode = FmMode.Wide; break; } this._agc.SampleRate = this._sampleRate / (double)(1 << this._decimationStageCount); this._agc.Decay = this._agcDecay; this._agc.Slope = this._agcSlope; this._agc.Threshold = this._agcThreshold; this._agc.UseHang = this._agcUseHang; this._needConfigure = false; } }
public void OpenFile(string filename, int outputDevice, int bufferSizeInMs) { this.Stop(); try { this._inputType = InputType.WaveFile; this._waveFile = new WaveFile(filename); this._outputDevice = outputDevice; this._inputSampleRate = (double)this._waveFile.SampleRate; this._inputBufferSize = (int)((double)bufferSizeInMs * this._inputSampleRate / 1000.0); this._decimationStageCount = StreamControl.GetDecimationStageCount(this._inputSampleRate, DetectorType.AM); int num = 1 << this._decimationStageCount; int num2 = num * StreamControl._bufferAlignment; this._inputBufferSize = this._inputBufferSize / num2 * num2; this._outputSampleRate = this._inputSampleRate / (double)num; this._outputBufferSize = this._inputBufferSize / num * 2; this._bufferSizeInMs = (double)this._inputBufferSize / this._inputSampleRate * 1000.0; } catch { this.Stop(); throw; } }
public MainForm() { _streamControl = new StreamControl(_streamHookManager); InitializeComponent(); InitializeGUI(); InitialiseSharpPlugins(); }
public MainForm() { this._hookManager = new HookManager(); this._hookManager.RegisterStreamHook((object) this._iqBalancerProcessor, ProcessorType.RawIQ); this._streamControl = new StreamControl(this._hookManager); this._vfo = new Vfo(this._hookManager); this._sharpControlProxy = new SharpControlProxy(this); this.InitializeComponent(); this.InitializeGUI(); }
public MainForm() { _streamControl = new StreamControl(); _vfoHookManager = new VfoHookManager(); _vfo = new Vfo(_vfoHookManager); _vfoHookManager.Vfo = _vfo; InitializeComponent(); InitializeGUI(); InitialiseSharpPlugins(); _vfoHookManager.RegisterStreamHook(this, ProcessorType.RawIQ); }