Fix compilation without --enable-argb
[monky] / src / mixer.c
index 1e3d962..109ce9b 100644 (file)
@@ -10,7 +10,7 @@
  * Please see COPYING for details
  *
  * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
- * Copyright (c) 2005-2009 Brenden Matthews, Philip Kovacs, et. al.
+ * Copyright (c) 2005-2010 Brenden Matthews, Philip Kovacs, et. al.
  *     (see AUTHORS)
  * All rights reserved.
  *
@@ -289,7 +289,7 @@ void parse_mixer_arg(struct text_object *obj, const char *arg)
  *  0 := channel average
  *  1 := right channel
  */
-void print_mixer(struct text_object *obj, int chan, char *p, int p_max_size)
+static void print_mixer_chan(struct text_object *obj, int chan, char *p, int p_max_size)
 {
        int val;
 
@@ -303,6 +303,21 @@ void print_mixer(struct text_object *obj, int chan, char *p, int p_max_size)
        percent_print(p, p_max_size, val);
 }
 
+void print_mixer(struct text_object *obj, char *p, int p_max_size)
+{
+       print_mixer_chan(obj, 0, p, p_max_size);
+}
+
+void print_mixerl(struct text_object *obj, char *p, int p_max_size)
+{
+       print_mixer_chan(obj, -1, p, p_max_size);
+}
+
+void print_mixerr(struct text_object *obj, char *p, int p_max_size)
+{
+       print_mixer_chan(obj, 1, p, p_max_size);
+}
+
 int check_mixer_muted(struct text_object *obj)
 {
        if (!mixer_is_mute(obj->data.l))
@@ -310,7 +325,6 @@ int check_mixer_muted(struct text_object *obj)
        return 1;
 }
 
-#ifdef X11
 void scan_mixer_bar(struct text_object *obj, const char *arg)
 {
        char buf1[64];
@@ -326,10 +340,13 @@ void scan_mixer_bar(struct text_object *obj, const char *arg)
 }
 
 /* see print_mixer() above for a description of 'chan' */
-void print_mixer_bar(struct text_object *obj, int chan, char *p)
+static void print_mixer_bar_chan(struct text_object *obj, int chan, char *p, int p_max_size)
 {
        int val;
 
+       if (!p_max_size)
+               return;
+
        if (chan < 0)
                val = mixer_get_left(obj->data.i);
        else if (chan == 0)
@@ -337,6 +354,20 @@ void print_mixer_bar(struct text_object *obj, int chan, char *p)
        else
                val = mixer_get_right(obj->data.i);
 
-       new_bar(obj, p, mixer_to_255(obj->data.i, val));
+       new_bar(obj, p, p_max_size, mixer_to_255(obj->data.i, val));
+}
+
+void print_mixer_bar(struct text_object *obj, char *p, int p_max_size)
+{
+       print_mixer_bar_chan(obj, 0, p, p_max_size);
+}
+
+void print_mixerl_bar(struct text_object *obj, char *p, int p_max_size)
+{
+       print_mixer_bar_chan(obj, -1, p, p_max_size);
+}
+
+void print_mixerr_bar(struct text_object *obj, char *p, int p_max_size)
+{
+       print_mixer_bar_chan(obj, 1, p, p_max_size);
 }
-#endif /* X11 */