<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
I have updated & cleaned the patch.<br>
Its now in 2 files, I wasnt sure how to combine them with git. can
someone explain how I would do this?<br>
<br>
The default key is shift + 'd'. (d for devices.). I dont know how the
VLC hotkey system likes keys to be done so that can be changed easily.<br>
<br>
Jean-Baptiste Kempf wrote:
<blockquote cite="mid:20080324061301.GA2268@via.ecp.fr" type="cite">
  <pre wrap="">On Mon, Mar 24, 2008, Dylan Yudaken wrote :
  </pre>
  <blockquote type="cite">
    <pre wrap="">I wrote a small patch to add a hotkey to VLC to cycle through the audio 
devices.
It could be useful if you run VLC on a tv and need to remotely switch
between them.
    </pre>
  </blockquote>
  <pre wrap=""><!---->OK.

  </pre>
  <blockquote type="cite">
    <pre wrap="">@@ -335,4 +335,5 @@ static inline int StringToKey( char *psz_key )
 #define ACTIONID_ZOOM_ORIGINAL         94
 #define ACTIONID_ZOOM_DOUBLE           95
 
+#define ACTIONID_AUDIODEVICE_CYCLE     103
    </pre>
  </blockquote>
  <pre wrap=""><!---->
Why 103 and not 96 ?

  </pre>
  <blockquote type="cite">
    <pre wrap="">@@ -626,19 +626,67 @@ static void Run( intf_thread_t *p_intf )
                 }
                 free( val.psz_string );
             }
-            else if( ( i_action == ACTIONID_ZOOM || i_action == ACTIONID_UNZOOM ) && p_vout )
-            {
-                vlc_value_t val={0}, val_list, text_list;
-                var_Get( p_vout, "zoom", &val );
-                if( var_Change( p_vout, "zoom", VLC_VAR_GETLIST,
-                                &val_list, &text_list ) >= 0 )
+            else if( i_action == ACTIONID_AUDIODEVICE_CYCLE && p_vout)
+             {
+               vlc_value_t val, list, list2;
+               int i_count, i;
+               aout_instance_t *p_aout = vlc_object_find( p_intf, VLC_OBJECT_AOUT, FIND_ANYWHERE );
+                var_Get( p_aout, "audio-device", &val );
+                var_Change( p_aout, "audio-device", VLC_VAR_GETCHOICES,
+                         &list, &list2 );
+                i_count = list.p_list->i_count;
+                if( i_count <= 1 )
                 {
-                    int i;
-                    for( i = 0; i < val_list.p_list->i_count; i++ )
+                    continue;
+                }
+                for( i = 1; i < i_count; i++ )
+                {
+                    if( val.i_int == list.p_list->p_values[i].i_int )
                     {
-                        if( val_list.p_list->p_values[i].f_float
+                        break;
+                    }
+                }
+                if( i == i_count )
+                {
+                    msg_Warn( p_aout,
+                              "invalid current audio device, selecting 0" );
+                     var_Set( p_aout, "audio-device",
+                             list.p_list->p_values[1] );
+                    i = 1;
+                   
+                }
+                else if( i == i_count -1 )
+                {
+                 var_Set( p_aout, "audio-device",
+                         list.p_list->p_values[0] );
+                    i = 0;
+                   
+                }
+                else
+                {
+                 var_Set( p_aout, "audio-device",
+                          list.p_list->p_values[i+1] );
+                    i++;
+            
+                }
+                vout_OSDMessage( VLC_OBJECT(p_input), DEFAULT_CHAN,
+                               _("Audio Device: %s"),
+                                list2.p_list->p_values[i].psz_string );
+           
+       }
+       else if( ( i_action == ACTIONID_ZOOM || i_action == ACTIONID_UNZOOM ) && p_vout )
+         {
+           vlc_value_t val={0}, val_list, text_list;
+           var_Get( p_vout, "zoom", &val );
+           if( var_Change( p_vout, "zoom", VLC_VAR_GETLIST,
+                                &val_list, &text_list ) >= 0 )
+             {
+               int i;
+               for( i = 0; i < val_list.p_list->i_count; i++ )
+                 {
+                   if( val_list.p_list->p_values[i].f_float
                            == val.f_float )
-                        {
+                     {
                             if( i_action == ACTIONID_ZOOM )
                                 i++;
                             else /* ACTIONID_UNZOOM */
    </pre>
  </blockquote>
  <pre wrap=""><!---->
Could you keep some correct code alignment please ?


  </pre>
  <blockquote type="cite">
    <pre wrap="">+#   define KEY_AUDIODEVICE_CYCLE  KEY_MODIFIER_SHIFT|'s'
    </pre>
  </blockquote>
  <pre wrap=""><!---->What is the rationnal of using shift+s for that ?


  </pre>
  <blockquote type="cite">
    <pre wrap="">+      //Dylan test
    </pre>
  </blockquote>
  <pre wrap=""><!---->Remove this

Else, it should be ok.

  </pre>
</blockquote>
</body>
</html>