Commit 967af603 authored by Stefano Miccoli's avatar Stefano Miccoli Committed by Max Kellermann

rounds alsa HW mixer volume towards ±∞ depending on sgn(∆ vol)

This alleviates a problem in which 'volume +1' cannot be undo by 'volume -1' when using alsa hw mixer. Closes #104
parent f1ef9f9d
ver 0.20.13 (not yet released)
* output
- osx: set up ring buffer to hold at least 100ms
* mixer
- alsa: fix rounding errors
* database
- simple: don't purge mount points on update/rescan
- simple: fix "mount" bug caused by bad compiler optimization
......
......@@ -292,7 +292,9 @@ AlsaMixer::SetVolume(unsigned volume)
{
assert(handle != nullptr);
int err = set_normalized_playback_volume(elem, 0.01*volume, 1);
double cur = get_normalized_playback_volume(elem, SND_MIXER_SCHN_FRONT_LEFT);
int delta = volume - lrint(100.*cur);
int err = set_normalized_playback_volume(elem, cur + 0.01*delta, delta);
if (err < 0)
throw FormatRuntimeError("failed to set ALSA volume: %s",
snd_strerror(err));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment