summaryrefslogtreecommitdiff
path: root/src/wx/config_dialog.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-11-30 22:15:46 +0100
committerCarl Hetherington <cth@carlh.net>2023-11-30 22:15:48 +0100
commit595d3ce932864fa5fb35cf9f52ac50178b8bd173 (patch)
treeef15a89002c252f674a1a785708b516159d335dc /src/wx/config_dialog.cc
parenta467249e1eb0dd1c19be19d040b9ded2eee42ef9 (diff)
Support RtAudio >= 6.
There's an API break, mostly about removing the use of exceptions.
Diffstat (limited to 'src/wx/config_dialog.cc')
-rw-r--r--src/wx/config_dialog.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc
index 00ae80a4c..104835f4a 100644
--- a/src/wx/config_dialog.cc
+++ b/src/wx/config_dialog.cc
@@ -880,6 +880,14 @@ SoundPage::setup ()
_sound_output_details->SetFont (font);
RtAudio audio (DCPOMATIC_RTAUDIO_API);
+#if (RTAUDIO_VERSION_MAJOR >= 6)
+ for (auto device_id: audio.getDeviceIds()) {
+ auto dev = audio.getDeviceInfo(device_id);
+ if (dev.outputChannels > 0) {
+ _sound_output->Append(std_to_wx(dev.name));
+ }
+ }
+#else
for (unsigned int i = 0; i < audio.getDeviceCount(); ++i) {
try {
auto dev = audio.getDeviceInfo (i);
@@ -890,6 +898,7 @@ SoundPage::setup ()
/* Something went wrong so let's just ignore that device */
}
}
+#endif
_sound->bind(&SoundPage::sound_changed, this);
_sound_output->Bind (wxEVT_CHOICE, bind(&SoundPage::sound_output_changed, this));
@@ -921,11 +930,15 @@ SoundPage::sound_output_changed ()
RtAudio audio (DCPOMATIC_RTAUDIO_API);
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) {
Config::instance()->unset_sound_output ();
} else {
@@ -948,11 +961,15 @@ SoundPage::config_changed ()
} else {
/* No configured output means we should use the default */
RtAudio audio (DCPOMATIC_RTAUDIO_API);
+#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
}
if (configured_so && current_so != configured_so) {
@@ -982,6 +999,14 @@ SoundPage::config_changed ()
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);
@@ -992,6 +1017,7 @@ SoundPage::config_changed ()
/* Never mind */
}
}
+#endif
}
_sound_output_details->SetLabel (