[MPlayer-cvslog] r23571 - in trunk/libaf: af_pan.c control.h
zuxy
subversion at mplayerhq.hu
Sun Jun 17 14:18:13 CEST 2007
Author: zuxy
Date: Sun Jun 17 14:18:13 2007
New Revision: 23571
Log:
Add AF_CONTROL_PAN_BALANCE control
Modified:
trunk/libaf/af_pan.c
trunk/libaf/control.h
Modified: trunk/libaf/af_pan.c
==============================================================================
--- trunk/libaf/af_pan.c (original)
+++ trunk/libaf/af_pan.c Sun Jun 17 14:18:13 2007
@@ -111,6 +111,23 @@ static int control(struct af_instance_s*
case AF_CONTROL_PAN_NOUT | AF_CONTROL_GET:
*(int*)arg = af->data->nch;
return AF_OK;
+ case AF_CONTROL_PAN_BALANCE | AF_CONTROL_SET:{
+ float val = *(float*)arg;
+ if (s->nch)
+ return AF_ERROR;
+ if (af->data->nch >= 2) {
+ s->level[0][0] = min(1.f, 1.f - val);
+ s->level[0][1] = max(0.f, val);
+ s->level[1][0] = max(0.f, -val);
+ s->level[1][1] = min(1.f, 1.f + val);
+ }
+ return AF_OK;
+ }
+ case AF_CONTROL_PAN_BALANCE | AF_CONTROL_GET:
+ if (s->nch)
+ return AF_ERROR;
+ *(float*)arg = s->level[0][1] - s->level[1][0];
+ return AF_OK;
}
return AF_UNKNOWN;
}
Modified: trunk/libaf/control.h
==============================================================================
--- trunk/libaf/control.h (original)
+++ trunk/libaf/control.h Sun Jun 17 14:18:13 2007
@@ -193,6 +193,8 @@ typedef struct af_control_ext_s{
// Number of outputs from pan, arg is int*
#define AF_CONTROL_PAN_NOUT 0x00001B00 | AF_CONTROL_FILTER_SPECIFIC
+// Balance, arg is float*; range -1 (left) to 1 (right), 0 center
+#define AF_CONTROL_PAN_BALANCE 0x00002500 | AF_CONTROL_FILTER_SPECIFIC
// Set equalizer gain, arg is a control_ext with a float*
#define AF_CONTROL_EQUALIZER_GAIN 0x00001C00 | AF_CONTROL_FILTER_SPECIFIC
More information about the MPlayer-cvslog
mailing list