Merge branch 'fix_362' of git://github.com/miccoli/MPD

This commit is contained in:
Max Kellermann 2018-11-11 12:30:58 +01:00
commit a958abde2f
2 changed files with 10 additions and 1 deletions

2
NEWS
View File

@ -4,6 +4,8 @@ ver 0.21.2 (not yet released)
- ffmpeg: fix broken sound with certain codecs
* output
- httpd: fix two crash bugs
* mixer
- alsa: fix more rounding errors
* fix zlib support
ver 0.21.1 (2018/11/04)

View File

@ -135,6 +135,13 @@ static int set_normalized_volume(snd_mixer_elem_t *elem,
if (err < 0)
return err;
/* two special cases to avoid rounding errors at 0% and
100% */
if (volume <= 0)
return set_raw[ctl_dir](elem, min);
else if (volume >= 1)
return set_raw[ctl_dir](elem, max);
value = lrint_dir(volume * (max - min), dir) + min;
return set_raw[ctl_dir](elem, value);
}
@ -143,7 +150,7 @@ static int set_normalized_volume(snd_mixer_elem_t *elem,
100% */
if (volume <= 0)
return set_dB[ctl_dir](elem, min, dir);
else if (volume >= 100)
else if (volume >= 1)
return set_dB[ctl_dir](elem, max, dir);
if (use_linear_dB_scale(min, max)) {