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:
wm4 2014-05-11 16:37:52 +02:00
parent 09ecf7a68a
commit 77ce54c698
1 changed files with 3 additions and 7 deletions

View File

@ -198,9 +198,6 @@ void mixer_getbalance(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;
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 */
memset(level, 0, sizeof(level));
for (i = 2; i < AF_NCH; i++) {
arg_ext.ch = i;
for (int i = 2; i < AF_NCH; i++) {
float level[AF_NCH] = {0};
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,
&arg_ext);
level[i] = 0.f;
}
af_pan_balance->control(af_pan_balance, AF_CONTROL_SET_PAN_BALANCE, &val);