mirror of https://github.com/mpv-player/mpv
mixer: make code more readable
You wouldn't have guessed that the bottom-most "level[i] = 0.f;" line was actually required. It even confused cppcheck.
This commit is contained in:
parent
09ecf7a68a
commit
77ce54c698
|
@ -198,9 +198,6 @@ void mixer_getbalance(struct mixer *mixer, float *val)
|
||||||
|
|
||||||
void mixer_setbalance(struct mixer *mixer, float val)
|
void mixer_setbalance(struct mixer *mixer, float val)
|
||||||
{
|
{
|
||||||
float level[AF_NCH];
|
|
||||||
int i;
|
|
||||||
af_control_ext_t arg_ext = { .arg = level };
|
|
||||||
struct af_instance *af_pan_balance;
|
struct af_instance *af_pan_balance;
|
||||||
|
|
||||||
mixer->balance = val;
|
mixer->balance = val;
|
||||||
|
@ -220,13 +217,12 @@ void mixer_setbalance(struct mixer *mixer, float val)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* make all other channels pass thru since by default pan blocks all */
|
/* make all other channels pass thru since by default pan blocks all */
|
||||||
memset(level, 0, sizeof(level));
|
for (int i = 2; i < AF_NCH; i++) {
|
||||||
for (i = 2; i < AF_NCH; i++) {
|
float level[AF_NCH] = {0};
|
||||||
arg_ext.ch = i;
|
|
||||||
level[i] = 1.f;
|
level[i] = 1.f;
|
||||||
|
af_control_ext_t arg_ext = { .ch = i, .arg = level };
|
||||||
af_pan_balance->control(af_pan_balance, AF_CONTROL_SET_PAN_LEVEL,
|
af_pan_balance->control(af_pan_balance, AF_CONTROL_SET_PAN_LEVEL,
|
||||||
&arg_ext);
|
&arg_ext);
|
||||||
level[i] = 0.f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
af_pan_balance->control(af_pan_balance, AF_CONTROL_SET_PAN_BALANCE, &val);
|
af_pan_balance->control(af_pan_balance, AF_CONTROL_SET_PAN_BALANCE, &val);
|
||||||
|
|
Loading…
Reference in New Issue