diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-07-25 16:29:27 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-07-26 11:39:59 +0200 |
| commit | 349b0ca2ef8ab16d95d57d121960480ecce0cb7f (patch) | |
| tree | 29a2fa8ebf618377325657fbc6e5ad7dc9c724b6 /src/wx/config_dialog.cc | |
| parent | 5fc64dfcf121d785de3445d10fa7510a30c55965 (diff) | |
Add AudioBackend::default_device_name().
Diffstat (limited to 'src/wx/config_dialog.cc')
| -rw-r--r-- | src/wx/config_dialog.cc | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc index da6dcbd16..d97eeecc5 100644 --- a/src/wx/config_dialog.cc +++ b/src/wx/config_dialog.cc @@ -912,20 +912,10 @@ SoundPage::sound_changed () void SoundPage::sound_output_changed () { - auto& audio = AudioBackend::instance()->rtaudio(); - auto const so = get_sound_output(); - string default_device; -#if (RTAUDIO_VERSION_MAJOR >= 6) - default_device = audio.getDeviceInfo(audio.getDefaultOutputDevice()).name; -#else - try { - default_device = audio.getDeviceInfo(audio.getDefaultOutputDevice()).name; - } catch (RtAudioError&) { - /* Never mind */ - } -#endif - if (!so || *so == default_device) { + auto default_device = AudioBackend::instance()->default_device_name(); + + if (!so || so == default_device) { Config::instance()->unset_sound_output (); } else { Config::instance()->set_sound_output (*so); @@ -948,15 +938,7 @@ SoundPage::config_changed () configured_so = config->sound_output().get(); } else { /* No configured output means we should use the default */ -#if (RTAUDIO_VERSION_MAJOR >= 6) - configured_so = audio.getDeviceInfo(audio.getDefaultOutputDevice()).name; -#else - try { - configured_so = audio.getDeviceInfo(audio.getDefaultOutputDevice()).name; - } catch (RtAudioError&) { - /* Probably no audio devices at all */ - } -#endif + configured_so = AudioBackend::instance()->default_device_name(); } if (configured_so && current_so != configured_so) { |
