chiark / gitweb /
Changes to HTML coverage output:
[disorder] / lib / mixer-alsa.c
index 7cf88788892c8f2088f629fc78f40bdf8b22f75e..1ab85ab3ad3070daccd40e1122fefe21bd879c6a 100644 (file)
@@ -1,21 +1,19 @@
 /*
  * This file is part of DisOrder
- * Copyright (C) 2007 Richard Kettlewell
+ * Copyright (C) 2007, 2008 Richard Kettlewell
  *
- * This program is free software; you can redistribute it and/or modify
+ * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 /** @file lib/mixer-alsa.c
  * @brief ALSA mixer support
  * (as I don't one).
  */
 
-#include <config.h>
+#include "common.h"
 
 #if HAVE_ALSA_ASOUNDLIB_H
 
-#include "types.h"
-
-#include <stdio.h>
-#include <string.h>
 #include <fcntl.h>
 #include <unistd.h>
-#include <stdlib.h>
 #include <errno.h>
 #include <stddef.h>
 #include <ctype.h>
@@ -108,11 +101,13 @@ static int alsa_open(struct alsa_mixer_state *h) {
   snd_mixer_selem_id_set_name(id, config->channel);
   snd_mixer_selem_id_set_index(id, atoi(config->mixer));
   if(!(h->elem = snd_mixer_find_selem(h->handle, id))) {
-    error(0, "snd_mixer_find_selem returned NULL");
+    error(0, "device '%s' mixer control '%s,%s' does not exist",
+         config->device, config->channel, config->mixer);
     goto error;
   }
   if(!snd_mixer_selem_has_playback_volume(h->elem)) {
-    error(0, "configured mixer control has no playback volume");
+    error(0, "device '%s' mixer control '%s,%s' has no playback volume",
+         config->device, config->channel, config->mixer);
     goto error;
   }
   if(snd_mixer_selem_is_playback_mono(h->elem)) {
@@ -123,7 +118,8 @@ static int alsa_open(struct alsa_mixer_state *h) {
   }
   if(!snd_mixer_selem_has_playback_channel(h->elem, h->left)
      || !snd_mixer_selem_has_playback_channel(h->elem, h->right)) {
-    error(0, "configured mixer control lacks required playback channels");
+    error(0, "device '%s' mixer control '%s,%s' lacks required playback channels",
+         config->device, config->channel, config->mixer);
     goto error;
   }
   snd_mixer_selem_get_playback_volume_range(h->elem, &h->min, &h->max);