]> git.sesse.net Git - vlc/blobdiff - modules/audio_filter/channel_mixer/headphone.c
* now 0.6.0-cvs
[vlc] / modules / audio_filter / channel_mixer / headphone.c
index ee7c3a40721ba4ff531803f5b2fe5b895e3114e4..7530b5c33a093ff00eb2d81063df6c72c6374253 100644 (file)
@@ -3,7 +3,7 @@
  *               -> gives the feeling of a real room with a simple headphone
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: headphone.c,v 1.1 2002/12/09 00:52:42 babal Exp $
+ * $Id: headphone.c,v 1.5 2003/05/15 22:27:37 massiot Exp $
  *
  * Authors: Boris Dorès <babal@via.ecp.fr>
  *
@@ -45,7 +45,15 @@ static void DoWork    ( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
+#define HEADPHONE_DIM_TEXT N_("Characteristic dimension")
+#define HEADPHONE_DIM_LONGTEXT N_( \
+     "Headphone virtual spatialization effect parameter: "\
+     "distance between front left speaker and listener in meters.")
+
 vlc_module_begin();
+    add_category_hint( N_("headphone"), NULL, VLC_FALSE );
+    add_integer( "headphone-dim", 5, NULL, HEADPHONE_DIM_TEXT,
+                 HEADPHONE_DIM_LONGTEXT, VLC_TRUE );
     set_description( _("headphone channel mixer with virtual spatialization effect") );
     set_capability( "audio filter", 0 );
     set_callbacks( Create, Destroy );
@@ -209,6 +217,14 @@ static int Init ( aout_filter_t * p_filter , struct aout_filter_sys_t * p_data
         i_next_atomic_operation += 2;
         i_source_channel_offset++;
     }
+    if ( i_physical_channels & AOUT_CHAN_REARCENTER )
+    {
+        ComputeChannelOperations ( p_data , i_rate
+                , i_next_atomic_operation , i_source_channel_offset
+                , 0 , -d_z , 1.5 / i_nb_channels );
+        i_next_atomic_operation += 2;
+        i_source_channel_offset++;
+    }
     if ( i_physical_channels & AOUT_CHAN_CENTER )
     {
         ComputeChannelOperations ( p_data , i_rate
@@ -225,6 +241,22 @@ static int Init ( aout_filter_t * p_filter , struct aout_filter_sys_t * p_data
         i_next_atomic_operation += 2;
         i_source_channel_offset++;
     }
+    if ( i_physical_channels & AOUT_CHAN_MIDDLELEFT )
+    {
+        ComputeChannelOperations ( p_data , i_rate
+                , i_next_atomic_operation , i_source_channel_offset
+                , -d_x , 0 , 1.5 / i_nb_channels );
+        i_next_atomic_operation += 2;
+        i_source_channel_offset++;
+    }
+    if ( i_physical_channels & AOUT_CHAN_MIDDLERIGHT )
+    {
+        ComputeChannelOperations ( p_data , i_rate
+                , i_next_atomic_operation , i_source_channel_offset
+                , d_x , 0 , 1.5 / i_nb_channels );
+        i_next_atomic_operation += 2;
+        i_source_channel_offset++;
+    }
 
     /* Initialize the overflow buffer
      * we need it because the process induce a delay in the samples */