Build fixes for Boost >= 1.73
[dcpomatic.git] / src / wx / config_dialog.cc
index 44fd8ecde5892ee2a1860c25444a07a97438724b..7a4bb92c9e16e1589785d8aac07377e6ebd2e102 100644 (file)
@@ -36,6 +36,9 @@ using boost::bind;
 using boost::optional;
 using boost::shared_ptr;
 using boost::function;
+#if BOOST_VERSION >= 106100
+using namespace boost::placeholders;
+#endif
 
 static
 bool
@@ -878,9 +881,17 @@ SoundPage::setup ()
 
        RtAudio audio (DCPOMATIC_RTAUDIO_API);
        for (unsigned int i = 0; i < audio.getDeviceCount(); ++i) {
-               RtAudio::DeviceInfo dev = audio.getDeviceInfo (i);
-               if (dev.probed && dev.outputChannels > 0) {
-                       _sound_output->Append (std_to_wx (dev.name));
+               try {
+                       RtAudio::DeviceInfo dev = audio.getDeviceInfo (i);
+                       if (dev.probed && dev.outputChannels > 0) {
+                               _sound_output->Append (std_to_wx (dev.name));
+                       }
+#ifdef DCPOMATIC_USE_RTERROR
+               } catch (RtError&) {
+#else
+               } catch (RtAudioError&) {
+#endif
+                       /* Something went wrong so let's just ignore that device */
                }
        }
 
@@ -913,7 +924,13 @@ SoundPage::sound_output_changed ()
 {
        RtAudio audio (DCPOMATIC_RTAUDIO_API);
        optional<string> const so = get_sound_output();
-       if (!so || *so == audio.getDeviceInfo(audio.getDefaultOutputDevice()).name) {
+       string default_device;
+       try {
+               default_device = audio.getDeviceInfo(audio.getDefaultOutputDevice()).name;
+       } catch (RtAudioError&) {
+               /* Never mind */
+       }
+       if (!so || *so == default_device) {
                Config::instance()->unset_sound_output ();
        } else {
                Config::instance()->set_sound_output (*so);
@@ -1040,7 +1057,6 @@ LocationsPage::GetLargeIcon () const
 void
 LocationsPage::setup ()
 {
-
        int r = 0;
 
        wxGridBagSizer* table = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);