af_volume: don't change volume if nothing is to be changed

On the float path. Note that this skips clipping, but we expect that
everything on the audio-path is pre-clipped anyway.
This commit is contained in:
wm4 2013-10-26 12:56:08 +02:00
parent 3b5657f0c1
commit b890093c44
1 changed files with 2 additions and 0 deletions

View File

@ -112,6 +112,7 @@ static struct mp_audio* play(struct af_instance* af, struct mp_audio* data)
int len = c->len/4; // Number of samples
for (int ch = 0; ch < nch; ch++) {
// Volume control (fader)
if (s->level[ch] != 1.0) {
for(i=ch;i<len;i+=nch){
register float x = a[i];
// Set volume
@ -125,6 +126,7 @@ static struct mp_audio* play(struct af_instance* af, struct mp_audio* data)
x=clamp(x,-1.0,1.0);
a[i] = x;
}
}
}
}
return c;