Mercurial > mplayer.hg
changeset 23551:63d9b7032bf3
Add AF_CONTROL_PAN_BALANCE control
author | zuxy |
---|---|
date | Sun, 17 Jun 2007 12:18:13 +0000 |
parents | 1915012c8f7d |
children | ba9e664dbbaa |
files | libaf/af_pan.c libaf/control.h |
diffstat | 2 files changed, 19 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libaf/af_pan.c Sun Jun 17 10:24:10 2007 +0000 +++ b/libaf/af_pan.c Sun Jun 17 12:18:13 2007 +0000 @@ -111,6 +111,23 @@ 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; }
--- a/libaf/control.h Sun Jun 17 10:24:10 2007 +0000 +++ b/libaf/control.h Sun Jun 17 12:18:13 2007 +0000 @@ -193,6 +193,8 @@ // 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