commit 03997ebb78edc2b174cd4b6972d95f967d22fe62
parent e1d1fdaba95c6241a1ed8d738e477ce58f45b4ec
Author: blut <CXblut@gmail.com>
Date: Sun, 8 Jun 2014 19:58:21 +0000
Add some comments
Diffstat:
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/dwm.suckless.org/dwmstatus/getvol.c b/dwm.suckless.org/dwmstatus/getvol.c
@@ -1,10 +1,18 @@
+/* include this into your dwmstatus.c and use get_vol() as volume.
+ * if your audio card and subunit numbers differ from 0,0 you might havo
+ * to use amixer, aplay and the /proc/asound file tree to adapt.
+ *
+ * I had compilation issues. As result i had to drop the -std=c99 and
+ * -pedantic flags from the config.mk
+ */
+
#include <alsa/asoundlib.h>
#include <alsa/control.h>
int
get_vol(void)
{
- long int vol;
+ int vol;
snd_hctl_t *hctl;
snd_ctl_elem_id_t *id;
snd_ctl_elem_value_t *control;
@@ -25,8 +33,8 @@ get_vol(void)
snd_ctl_elem_value_set_id(control, id);
snd_hctl_elem_read(elem, control);
- vol = snd_ctl_elem_value_get_integer(control,0);
+ vol = (int)snd_ctl_elem_value_get_integer(control,0);
snd_hctl_close(hctl);
- return (int)vol;
+ return vol;
}