[vlc-devel] [PATCH 7/7] qt: add device preferences for mmdevice

Thomas Guillem thomas at gllm.fr
Tue Feb 27 11:41:11 CET 2018


Like for other Windows aouts, this preference can be used to save the preferred
audio device that will be used across several instances of VLC.

CONFIG_AUDIO_DEVICE should also be used for others aouts (in order to forward
the device change to the aout module).
---
 modules/gui/qt/components/simple_preferences.cpp | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/modules/gui/qt/components/simple_preferences.cpp b/modules/gui/qt/components/simple_preferences.cpp
index 461201b47a..ec8f823e43 100644
--- a/modules/gui/qt/components/simple_preferences.cpp
+++ b/modules/gui/qt/components/simple_preferences.cpp
@@ -299,6 +299,19 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
                 if( widget ) widget->setEnabled( false );                 \
             }
 
+#define CONFIG_AUDIO_DEVICE( option, label, qcontrol )                    \
+            p_config =  config_FindConfig( option );                      \
+            if( p_config )                                                \
+            {                                                             \
+                control =  new AudioDeviceConfigControl( p_intf,          \
+                           p_config, label, qcontrol );                   \
+                controls.append( control );                               \
+            }                                                             \
+            else {                                                        \
+                QWidget *widget = label;                                  \
+                qcontrol->setVisible( false );                            \
+                if( widget ) widget->setEnabled( false );                 \
+            }
 
 #define CONFIG_GENERIC_NO_BOOL( option, type, label, qcontrol )           \
             p_config =  config_FindConfig( option );                      \
@@ -490,6 +503,11 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
 #endif
 
 #ifdef _WIN32
+            audioControl( MMDevice );
+            optionWidgets["mmdeviceL" ] = MMDeviceLabel;
+            optionWidgets["mmdeviceW" ] = MMDeviceDevice;
+            CONFIG_AUDIO_DEVICE( "mmdevice-audio-device", MMDeviceLabel, MMDeviceDevice );
+
             CONFIG_GENERIC( "mmdevice-passthrough", IntegerList,
                             ui.mmdevicePassthroughLabel, mmdevicePassthroughBox );
             optionWidgets["mmdevicePassthroughL"] = ui.mmdevicePassthroughLabel;
@@ -961,6 +979,8 @@ void SPrefsPanel::updateAudioOptions( int number)
     const bool mmDeviceEnabled = value == "mmdevice" || value == "any";
     optionWidgets["mmdevicePassthroughL"]->setVisible( mmDeviceEnabled );
     optionWidgets["mmdevicePassthroughB"]->setVisible( mmDeviceEnabled );
+    optionWidgets["mmdeviceW"]->setVisible( mmDeviceEnabled );
+    optionWidgets["mmdeviceL"]->setVisible( mmDeviceEnabled );
 
     optionWidgets["directxW"]->setVisible( ( value == "directsound" ) );
     optionWidgets["directxL"]->setVisible( ( value == "directsound" ) );
-- 
2.11.0



More information about the vlc-devel mailing list