mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-25 12:10:03 +00:00
merge mixer bars to callbacks.barval
This commit is contained in:
parent
4d7f2e720d
commit
f79c58ef47
@ -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;
|
||||
|
30
src/mixer.c
30
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));
|
||||
}
|
||||
|
@ -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_*/
|
||||
|
Loading…
Reference in New Issue
Block a user