diff --git a/src/core.c b/src/core.c index 842709a0..0faee086 100644 --- a/src/core.c +++ b/src/core.c @@ -791,13 +791,13 @@ struct text_object *construct_text_object(const char *s, const char *arg, long obj->callbacks.print = &print_mixerr; END OBJ(mixerbar, 0) scan_mixer_bar(obj, arg); - obj->callbacks.print = &print_mixer_bar; + obj->callbacks.barval = &mixer_barval; END OBJ(mixerlbar, 0) scan_mixer_bar(obj, arg); - obj->callbacks.print = &print_mixerl_bar; + obj->callbacks.barval = &mixerl_barval; END OBJ(mixerrbar, 0) scan_mixer_bar(obj, arg); - obj->callbacks.print = &print_mixerr_bar; + obj->callbacks.barval = &mixerr_barval; END OBJ_IF(if_mixer_mute, 0) parse_mixer_arg(obj, arg); obj->callbacks.iftest = &check_mixer_muted; diff --git a/src/mixer.c b/src/mixer.c index b3f11965..5dff58a4 100644 --- a/src/mixer.c +++ b/src/mixer.c @@ -339,35 +339,17 @@ void scan_mixer_bar(struct text_object *obj, const char *arg) } } -/* see print_mixer() above for a description of 'chan' */ -static void print_mixer_bar_chan(struct text_object *obj, int chan, char *p, int p_max_size) +uint8_t mixer_barval(struct text_object *obj) { - int val; - - if (!p_max_size) - return; - - if (chan < 0) - val = mixer_get_left(obj->data.i); - else if (chan == 0) - val = mixer_get_avg(obj->data.i); - else - val = mixer_get_right(obj->data.i); - - new_bar(obj, p, p_max_size, mixer_to_255(obj->data.i, val)); + return mixer_to_255(obj->data.i, mixer_get_avg(obj->data.i)); } -void print_mixer_bar(struct text_object *obj, char *p, int p_max_size) +uint8_t mixerl_barval(struct text_object *obj) { - print_mixer_bar_chan(obj, 0, p, p_max_size); + return mixer_to_255(obj->data.i, mixer_get_left(obj->data.i)); } -void print_mixerl_bar(struct text_object *obj, char *p, int p_max_size) +uint8_t mixerr_barval(struct text_object *obj) { - 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); + return mixer_to_255(obj->data.i, mixer_get_right(obj->data.i)); } diff --git a/src/mixer.h b/src/mixer.h index 4ebd3ab0..a1f4d174 100644 --- a/src/mixer.h +++ b/src/mixer.h @@ -10,8 +10,8 @@ void print_mixerr(struct text_object *, char *, int); int check_mixer_muted(struct text_object *); void scan_mixer_bar(struct text_object *, const char *); -void print_mixer_bar(struct text_object *, char *, int); -void print_mixerl_bar(struct text_object *, char *, int); -void print_mixerr_bar(struct text_object *, char *, int); +uint8_t mixer_barval(struct text_object *); +uint8_t mixerl_barval(struct text_object *); +uint8_t mixerr_barval(struct text_object *); #endif /*MIXER_H_*/