Exemplo n.º 1
0
 public SetupForm()
 {
     InitializeComponent();
     Settings.LoadSettings();
     LoadSettings();
 }
Exemplo n.º 2
0
        public override bool Init()
        {
            try
            {
                _ac = new CoreAudioController();
            }
            catch (Exception ex)
            {
                Log.Error("Error occured during Init()");
                Log.Error(ex.Message);
            }

            // Load settings
            Settings.LoadSettings();

            // Button Handler
            GUIWindowManager.OnNewAction += OnNewAction;
            Settings.LoadSettings();

            if (!string.IsNullOrEmpty(Settings.DefaultPlaybackDevice))
            {
                var devices = GetPlaybackDevices();

                Log.Debug("Setting default playback device on startup: " + Settings.DefaultPlaybackDevice);

                // Find default audio device match to setting
                CoreAudioDevice playbackDeviceLookup = devices.FirstOrDefault(d =>
                                                                              d != null &&
                                                                              d.FullName.Equals(Settings.DefaultPlaybackDevice, StringComparison.CurrentCultureIgnoreCase));

                if (playbackDeviceLookup != null)
                {
                    SetPlaybackDevice(playbackDeviceLookup);

                    if (Settings.LAVbitstreamPerDevice)
                    {
                        SetLavBitstreamSettings(playbackDeviceLookup.FullName);
                    }
                }
                else
                {
                    Log.Error("Default playback device not found!");
                }
            }
            else if (Settings.LAVbitstreamPerDevice)
            {
                var devices = GetPlaybackDevices();

                // Find default audio device
                CoreAudioDevice defaultPlaybackDevice = devices.FirstOrDefault(d =>
                                                                               d != null &&
                                                                               d.IsDefaultDevice);

                if (defaultPlaybackDevice != null)
                {
                    SetLavBitstreamSettings(defaultPlaybackDevice.FullName);
                }
                else
                {
                    Log.Error("No playback devices found!");
                }
            }

            return(true);
        }