From 7246dc4381c6c95454672a5c1aff65a02d6d3747 Mon Sep 17 00:00:00 2001 From: Laslo Hunhold Date: Sun, 24 Sep 2017 15:33:01 +0200 Subject: Move components into dedicated subdirectory This brings us a lot more tidiness. --- volume.c | 43 ------------------------------------------- 1 file changed, 43 deletions(-) delete mode 100644 volume.c (limited to 'volume.c') diff --git a/volume.c b/volume.c deleted file mode 100644 index 0074754..0000000 --- a/volume.c +++ /dev/null @@ -1,43 +0,0 @@ -/* See LICENSE file for copyright and license details. */ -#include -#include -#include -#include -#include -#include -#include - -#include "util.h" - -const char * -vol_perc(const char *card) -{ - unsigned int i; - int v, afd, devmask; - char *vnames[] = SOUND_DEVICE_NAMES; - - afd = open(card, O_RDONLY | O_NONBLOCK); - if (afd == -1) { - warn("Cannot open %s", card); - return NULL; - } - - if (ioctl(afd, SOUND_MIXER_READ_DEVMASK, &devmask) == -1) { - warn("Cannot get volume for %s", card); - close(afd); - return NULL; - } - for (i = 0; i < LEN(vnames); i++) { - if (devmask & (1 << i) && !strcmp("vol", vnames[i])) { - if (ioctl(afd, MIXER_READ(i), &v) == -1) { - warn("vol_perc: ioctl"); - close(afd); - return NULL; - } - } - } - - close(afd); - - return bprintf("%d", v & 0xff); -} -- cgit v1.2.3