summaryrefslogtreecommitdiff
path: root/src/wx/config_dialog.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-07-25 16:29:49 +0200
committerCarl Hetherington <cth@carlh.net>2024-07-26 11:39:59 +0200
commit98b7a493933a5a47c6e1abb21ef2710ad2730a0e (patch)
tree840ec2ca3fd693e052207b971d54e080318c71a7 /src/wx/config_dialog.cc
parent349b0ca2ef8ab16d95d57d121960480ecce0cb7f (diff)
Add AudioBackend::device_output_channels().
Diffstat (limited to 'src/wx/config_dialog.cc')
-rw-r--r--src/wx/config_dialog.cc23
1 files changed, 1 insertions, 22 deletions
diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc
index d97eeecc5..12e914742 100644
--- a/src/wx/config_dialog.cc
+++ b/src/wx/config_dialog.cc
@@ -964,28 +964,7 @@ SoundPage::config_changed ()
apis[RtAudio::LINUX_OSS] = _("OSS");
apis[RtAudio::RTAUDIO_DUMMY] = _("Dummy");
- int channels = 0;
- if (configured_so) {
-#if (RTAUDIO_VERSION_MAJOR >= 6)
- for (auto device_id: audio.getDeviceIds()) {
- auto info = audio.getDeviceInfo(device_id);
- if (info.name == *configured_so && info.outputChannels > 0) {
- channels = info.outputChannels;
- }
- }
-#else
- for (unsigned int i = 0; i < audio.getDeviceCount(); ++i) {
- try {
- auto info = audio.getDeviceInfo(i);
- if (info.name == *configured_so && info.outputChannels > 0) {
- channels = info.outputChannels;
- }
- } catch (RtAudioError&) {
- /* Never mind */
- }
- }
-#endif
- }
+ int const channels = configured_so ? AudioBackend::instance()->device_output_channels(*configured_so).get_value_or(0) : 0;
_sound_output_details->SetLabel (
wxString::Format(_("%d channels on %s"), channels, apis[audio.getCurrentApi()])