macosx: retain the macosx-audio-device across multiple sessions (close #6551)
authorFelix Paul Kühne <fkuehne@videolan.org>
Mon, 2 Apr 2012 08:10:31 +0000 (10:10 +0200)
committerFelix Paul Kühne <fkuehne@videolan.org>
Mon, 2 Apr 2012 08:10:31 +0000 (10:10 +0200)
modules/gui/macosx/MainMenu.m
modules/gui/macosx/intf.m

index a43977c..73d3e11 100644 (file)
@@ -1129,6 +1129,10 @@ static VLCMainMenu *_o_sharedInstance = nil;
     if( !strcmp( [menuContent name], "fullscreen" ) || !strcmp( [menuContent name], "video-on-top" ) )
         var_Set( pl_Get( VLCIntf ), [menuContent name] , [menuContent value] );
 
+    /* save our audio device across multiple sessions */
+    if( !strcmp( [menuContent name], "audio-device" ) )
+        config_PutInt( VLCIntf, "macosx-audio-device", [menuContent value].i_int );
+
     p_object = [menuContent vlcObject];
 
     if( p_object != NULL )
index 988652a..2cc8143 100644 (file)
@@ -618,6 +618,13 @@ static VLCMain *_o_sharedMainInstance = nil;
     if( OSX_LION )
         b_nativeFullscreenMode = config_GetInt( p_intf, "macosx-nativefullscreenmode" );
 #endif
+
+    /* recover stored audio device, if set
+     * in case it was unplugged in the meantime, auhal will fall back on the default */
+    int i_value = config_GetInt( p_intf, "macosx-audio-device" );
+    if (i_value > 0)
+        var_SetInteger( pl_Get( VLCIntf ), "audio-device", i_value );
+
     nib_main_loaded = TRUE;
 }