summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-05-11 16:37:52 +0200
committerwm4 <wm4@nowhere>2014-05-11 16:41:19 +0200
commit77ce54c6984cadb91d105c5ed768a07bdbdfee5a (patch)
tree17b3c07eaee38efe6223baecaa846ea3aa02e31d /audio
parent09ecf7a68adf3798d357bc529a7e76c72534b208 (diff)
downloadmpv-77ce54c6984cadb91d105c5ed768a07bdbdfee5a.tar.bz2
mpv-77ce54c6984cadb91d105c5ed768a07bdbdfee5a.tar.xz
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.
Diffstat (limited to 'audio')
-rw-r--r--audio/mixer.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/audio/mixer.c b/audio/mixer.c
index 208aea955a..7a26b83e5e 100644
--- a/audio/mixer.c
+++ b/audio/mixer.c
@@ -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);