changeset 16493:851d10933f27

Fix af_pan commandline mess and (hopefully) improve description. It should now output the right number of channels and it doesn't silently clamp values to the too restrictive [0, 1] range.
author reimar
date Thu, 15 Sep 2005 11:41:23 +0000
parents 5bec810fc9dc
children c02c94987480
files DOCS/man/en/mplayer.1 libaf/af_pan.c
diffstat 2 files changed, 16 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/DOCS/man/en/mplayer.1	Thu Sep 15 10:25:43 2005 +0000
+++ b/DOCS/man/en/mplayer.1	Thu Sep 15 11:41:23 2005 +0000
@@ -3986,18 +3986,22 @@
 .PD 0
 .RSs
 .IPs <n>\ \ 
-number of input channels (1\-6)
+number of output channels (1\-6)
 .IPs <lij>
-How much of input channel j is mixed into output channel i (0\-1).
+How much of input channel i is mixed into output channel j (0\-1).
+So in principle you first have n numbers saying what to do with the
+first input channel, then n numbers that act on the second input channel
+etc.
+If you don't specify any numbers for some input channels, 0 is assumed.
 .RE
 .sp 1
 .RS
 .I EXAMPLE:
 .RE
 .RSs
-.IPs "mplayer \-af pan=1:0.5:0.5 \-channels 1 media.avi"
+.IPs "mplayer \-af pan=1:0.5:0.5 media.avi"
 Would down-mix from stereo to mono.
-.IPs "mplayer \-af pan=3:1:0:1:0.5:0.5 \-channels 3 media.avi"
+.IPs "mplayer \-af pan=3:1:0:0.5:0:1:0.5 media.avi"
 Would give 3 channel output leaving channels 0 and 1 intact,
 and mix channels 0 and 1 into output channel 2 (which could
 be sent to a subwoofer for example).
@@ -8963,7 +8967,7 @@
 .
 .TP
 .B Play a 6-channel AAC file with only two speakers:
-mplayer \-rawaudio on:format=0xff \-af pan=6:.32:.39:.06:.17:-.17:.33:.32:.06:.39:-.17:.17:.33 adts_he-aac160_51.aac
+mplayer \-rawaudio on:format=0xff \-af pan=2:.32:.32:.39:.06:.06:.39:.17:-.17:-.17:.17:.33:.33 adts_he-aac160_51.aac
 .br
 You might want to play a bit with the pan values (e.g multiply with a value) to
 increase volume or avoid clipping.
--- a/libaf/af_pan.c	Thu Sep 15 10:25:43 2005 +0000
+++ b/libaf/af_pan.c	Thu Sep 15 11:41:23 2005 +0000
@@ -64,10 +64,9 @@
     cp = &((char*)arg)[n];
     j = 0; k = 0;
     while((*cp == ':') && (k < AF_NCH)){
-      sscanf(cp, ":%f%n" , &s->level[k][j], &n);
-      s->level[k][j] = clamp(s->level[k][j],0.0,1.0);
+      sscanf(cp, ":%f%n" , &s->level[j][k], &n);
       af_msg(AF_MSG_VERBOSE,"[pan] Pan level from channel %i to" 
-	     " channel %i = %f\n",j,k,s->level[k][j]);
+	     " channel %i = %f\n",k,j,s->level[j][k]);
       cp =&cp[n];
       j++;
       if(j>=nch){
@@ -81,14 +80,18 @@
     int    i;
     int    ch = ((af_control_ext_t*)arg)->ch;
     float* level = ((af_control_ext_t*)arg)->arg;
+    if (ch >= AF_NCH)
+      return AF_FALSE;
     for(i=0;i<AF_NCH;i++)
-      s->level[ch][i] = clamp(level[i],0.0,1.0);
+      s->level[ch][i] = level[i];
     return AF_OK;
   }
   case AF_CONTROL_PAN_LEVEL | AF_CONTROL_GET:{
     int    i;
     int ch = ((af_control_ext_t*)arg)->ch;
     float* level = ((af_control_ext_t*)arg)->arg;
+    if (ch >= AF_NCH)
+      return AF_FALSE;
     for(i=0;i<AF_NCH;i++)
       level[i] = s->level[ch][i];
     return AF_OK;