private void AudioSetup() { StopAudioEngine(); lock (globalLock) { try { // this is done because the devices and Ids go a bit t**s when you re-initialize... string serialized = null; if (realtimeConfig != null) { serialized = realtimeConfig.Serialize(); } PortAudio.Pa_Terminate(); PortAudio.Pa_Initialize(); RealtimeHostConfig deserialized = null; if (serialized != null) { deserialized = RealtimeHostConfig.Deserialize(serialized); } // Use the graphical editor to create a new config var config = RealtimeHostConfig.CreateConfig(deserialized); if (config != null) { realtimeConfig = config; } } catch (InvalidFormatException ex) { Logging.ShowMessage(ex.Message, LogType.Warning); } catch (Exception) { realtimeConfig = RealtimeHostConfig.CreateConfig(); } GetChannelNames(realtimeConfig); NotifyPropertyChanged(nameof(SamplerateWarning)); SaveSettings(); } UpdateMemoryMap(); StartAudioEngine(); }
private void LoadAudioConfig(RealtimeHostConfig config) { Console.WriteLine("Loading RealtimeHostConfig with the following settings:"); Console.WriteLine(config.Serialize()); if (config != null) { host.SetConfig(config); } if (host.Config != null) { StartAudio(); StopAudio(); StartAudio(); } }