private void Loading() { try { //获取本地保存的配置 _configManager = _localDataManager.GetSettingConfigData() ?? new ConfigManager { AudioInfo = new AudioInfo(), ServerInfo = new ServerInfo() { BmsServerPort = GlobalData.Instance.LocalSetting.BmsServerPort, ServerIp = GlobalData.Instance.LocalSetting.ServerIp } }; if (_configManager.AudioInfo == null) { _configManager.AudioInfo = new AudioInfo(); } var parameterData = _localDataManager.GetSettingParameter(); //设备 var audioSourceList = _meetingSdkAgent.GetMicrophones(); var docSourceList = _meetingSdkAgent.GetMicrophones(); var audioOutPutList = _meetingSdkAgent.GetLoudSpeakers(); var sampleRateList = parameterData.AudioParameterSampleRates; var aac = parameterData.AudioParameterAACs; //装载数据源 audioSourceList.Result.ToList().ForEach(a => { AudioSource.Add(a); }); docSourceList.Result.ToList().ForEach(d => { DocAudioSource.Add(d); }); audioOutPutList.Result.ToList().ForEach(o => { AudioOutPutDevice.Add(o); }); aac.ForEach(o => { Aac.Add(o.AAC); }); sampleRateList.ForEach(o => { SampleRate.Add(o.SampleRate); }); AudioSource.Add(string.Empty); DocAudioSource.Add(string.Empty); //设置默认选项 SetDefaultSetting(); if (audioSourceList.Result.All(o => o != SelectedAudioSource)) { SelectedAudioSource = string.Empty; } if (docSourceList.Result.All(o => o != SelectedDocAudioSource)) { SelectedDocAudioSource = string.Empty; } if (audioOutPutList.Result.All(o => o != SelectedAudioOutPutDevice)) { SelectedAudioOutPutDevice = string.Empty; } } catch (Exception ex) { Log.Logger.Error($"音频设置加载信息发生异常 exception:{ex}"); MessageQueueManager.Instance.AddError(MessageManager.LoadingError); } }
private void Init_Audio_Settings() { SelectedAudioSource = null; SelectedAac = 0; SelectedAudioOutPutDevice = null; SelectedDocAudioSource = null; SelectedSampleRate = 0; AudioSource.Clear(); DocAudioSource.Clear(); AudioOutPutDevice.Clear(); Aac.Clear(); SampleRate.Clear(); //设备 var microphones = _meetingSdkAgent.GetMicrophones(); var audioSourceList = microphones; var docSourceList = microphones; var audioOutPutList = _meetingSdkAgent.GetLoudSpeakers(); var sampleRateList = _settingParameter.AudioParameterSampleRates; var aac = _settingParameter.AudioParameterAACs; //装载数据源 audioSourceList.Result.ToList().ForEach(a => { AudioSource.Add(a); }); docSourceList.Result.ToList().ForEach(d => { DocAudioSource.Add(d); }); audioOutPutList.Result.ToList().ForEach(o => { AudioOutPutDevice.Add(o); }); aac.ForEach(o => { Aac.Add(o.AAC); }); sampleRateList.ForEach(o => { SampleRate.Add(o.SampleRate); }); AudioSource.Add(string.Empty); DocAudioSource.Add(string.Empty); //设置默认选项 SetDefaultAudioSetting(); if (audioSourceList.Result.All(o => o != SelectedAudioSource)) { SelectedAudioSource = string.Empty; } if (docSourceList.Result.All(o => o != SelectedDocAudioSource)) { SelectedDocAudioSource = string.Empty; } if (audioOutPutList.Result.All(o => o != SelectedAudioOutPutDevice)) { SelectedAudioOutPutDevice = string.Empty; } }