mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-26 20:31:17 +00:00
Fix wrong mixer values on some systems (thanks hoffa)
This commit is contained in:
parent
656177e0de
commit
ac6dff791f
13
src/mixer.c
13
src/mixer.c
@ -177,11 +177,16 @@ int mixer_init (const char *name)
|
||||
}
|
||||
static int mixer_get_avg (int i)
|
||||
{
|
||||
long val;
|
||||
long val;
|
||||
|
||||
snd_mixer_handle_events (data.mixer);
|
||||
snd_mixer_selem_get_playback_volume (data.elem, 0, &val);
|
||||
return (int) val;
|
||||
snd_mixer_handle_events (data.mixer);
|
||||
snd_mixer_selem_get_playback_volume (data.elem, 0, &val);
|
||||
if(data.vol_max != 100) {
|
||||
float avgf = ((float)val / data.vol_max) * 100;
|
||||
int avg = (int)avgf;
|
||||
return (avgf - avg < 0.5) ? avg : avg + 1;
|
||||
}
|
||||
return (int) val;
|
||||
}
|
||||
static int mixer_get_left (int i)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user