public void InitializeStreams() { LiveAudio = new LiveAudioPlayer(new G313AudioProvider(Radio), fftAnalysis: false, preBuffer: Settings.AudioBuffer); LiveIf = new LiveAudioPlayer(new G313IfProvider(Radio), fftAnalysis: false, preBuffer: Settings.AudioBuffer); RecordAudio = new LiveAudioRecorder(new G313AudioProvider(Radio)); RecordIf = new LiveAudioRecorder(new G313IfProvider(Radio)); RecordMp3Audio = new LiveMp3Recorder(new G313AudioProvider(Radio)); RecordMp3If = new LiveMp3Recorder(new G313IfProvider(Radio)); FftAnalyzer = new LiveFftAnalyzer(new G313IfProvider(Radio)); }
private void UpdateVolume() { LiveAudioPlayer audioPlayer = _model.Ddc2[0].AudioPlayer; if (MuteState) { return; } float volume = !SquelchView.Squelched ? _volume : 0f; if (audioPlayer != null && _audioPlayerVolume != volume) { _audioPlayerVolume = volume; audioPlayer.VolumeLevel = volume; } }
//private WaveformControl WaveformIf; //private WaveformControl WaveformDdc1; //private WaveformControl WaveformDdc2; #region Costructor private RadioViewModel() { logger.Debug("RadioViewModel Ctor"); try { _model = new RadioModel(); _model.Initialize(); InitializeReceiver1(); MeterViewDemodulator = new MeterViewModel(_model, 0); MeterViewDdc1 = new MeterViewModel(_model, 0); SquelchView = new SquelchViewModel(_model); /* UNCOMMENT THIS BLOCK * SpectrumAnalyzerIf = vo.SpectrumAnalyzerIf; * SpectrumAnalyzerDdc1 = vo.SpectrumAnalyzerDdc1; * SpectrumAnalyzerDdc2 = vo.SpectrumAnalyzerDdc2; * Waterfall = vo.WaterfallAnalyzer; */ IfSpectrumView = new IfSpectrumViewModel(this, SpectrumAnalyzerIf); Ddc1SpectrumView = new Ddc1SpectrumViewModel(this, SpectrumAnalyzerDdc1); Ddc2SpectrumView = new Ddc2SpectrumViewModel(this, SpectrumAnalyzerDdc2); Ddc2View = new Ddc2ViewModel(); InitializeReceiver(); CommandTuneToPeak = new DelegateCommand(() => Ddc2RelativeFrequency = (int)(MeterViewDdc1.PeakFrequency * 1000000 - Ddc1Frequency)); CommandPeakToCenter = new DelegateCommand(() => AbsoluteFrequency = (uint)Ddc2AbsoluteFrequency); CommandNextStep = new DelegateCommand(() => AbsoluteFrequency += FrequencyStep); CommandNextTenStep = new DelegateCommand(() => AbsoluteFrequency += (FrequencyStep * 10)); CommandPreviousStep = new DelegateCommand(() => AbsoluteFrequency -= FrequencyStep); CommandPreviousTenStep = new DelegateCommand(() => AbsoluteFrequency -= (FrequencyStep * 10)); CommandOpenSetup = new DelegateCommand(() => { var settings = new SettingsWindow(_model); settings.ShowDialog(); // ReInitDataContext(); }); CommandStartup = new RelayCommand((object obj) => { lock (_startupLock) { G31DdcMainWnd wnd = obj as G31DdcMainWnd; if (SpectrumAnalyzerIf == null) { SpectrumAnalyzerIf = wnd.WaveformIf; IfSpectrumView = new IfSpectrumViewModel(this, SpectrumAnalyzerIf); SpectrumAnalyzerDdc1 = wnd.WaveformDdc1; Ddc1SpectrumView = new Ddc1SpectrumViewModel(this, SpectrumAnalyzerDdc1); SpectrumAnalyzerDdc2 = wnd.WaveformDdc2; Ddc2SpectrumView = new Ddc2SpectrumViewModel(this, SpectrumAnalyzerDdc2); Waterfall = wnd.Waterfall; } } }); // VideoPoints = _model.FftAnalyzerIf.FftLength; // VideoPoints = 1000; FrequencyStep = 500; MuteState = false; LiveAudioPlayer audioPlayer = _model.Ddc2[0].AudioPlayer; if (audioPlayer != null) { _audioPlayerVolume = audioPlayer.VolumeLevel; Volume = _audioPlayerVolume; } _availableDdc1 = _model.AvailableDdc1.ToList <DdcInfo>(); ActiveDdc1 = _model.AvailableDdc1[_model.AvailableDdc1.Length - 1]; } catch (OperationFailedException ex) { logger.Error("Failed to initializa radio.", ex); MessageBox.Show("Failed to initializa radio. Start radio in demo mode."); } }
public void PlayStart() { AudioPlayer = new LiveAudioPlayer(_audioProvider); new Task(() => AudioPlayer.Play()).Start(); }