mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-25 12:10:03 +00:00
convert mixer values to callbacks.percentage
This commit is contained in:
parent
36a202091e
commit
61591def8e
@ -786,13 +786,13 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
#endif /* X11*/
|
||||
END OBJ(mixer, 0)
|
||||
parse_mixer_arg(obj, arg);
|
||||
obj->callbacks.print = &print_mixer;
|
||||
obj->callbacks.percentage = &mixer_percentage;
|
||||
END OBJ(mixerl, 0)
|
||||
parse_mixer_arg(obj, arg);
|
||||
obj->callbacks.print = &print_mixerl;
|
||||
obj->callbacks.percentage = &mixerl_percentage;
|
||||
END OBJ(mixerr, 0)
|
||||
parse_mixer_arg(obj, arg);
|
||||
obj->callbacks.print = &print_mixerr;
|
||||
obj->callbacks.percentage = &mixerr_percentage;
|
||||
END OBJ(mixerbar, 0)
|
||||
scan_mixer_bar(obj, arg);
|
||||
obj->callbacks.barval = &mixer_barval;
|
||||
|
31
src/mixer.c
31
src/mixer.c
@ -284,38 +284,19 @@ void parse_mixer_arg(struct text_object *obj, const char *arg)
|
||||
obj->data.l = mixer_init(arg);
|
||||
}
|
||||
|
||||
/* chan specifies the channel to print:
|
||||
* -1 := left channel
|
||||
* 0 := channel average
|
||||
* 1 := right channel
|
||||
*/
|
||||
static void print_mixer_chan(struct text_object *obj, int chan, char *p, int p_max_size)
|
||||
uint8_t mixer_percentage(struct text_object *obj)
|
||||
{
|
||||
int val;
|
||||
|
||||
if (chan < 0)
|
||||
val = mixer_get_left(obj->data.l);
|
||||
else if (chan == 0)
|
||||
val = mixer_get_avg(obj->data.l);
|
||||
else
|
||||
val = mixer_get_right(obj->data.l);
|
||||
|
||||
percent_print(p, p_max_size, val);
|
||||
return mixer_get_avg(obj->data.l);
|
||||
}
|
||||
|
||||
void print_mixer(struct text_object *obj, char *p, int p_max_size)
|
||||
uint8_t mixerl_percentage(struct text_object *obj)
|
||||
{
|
||||
print_mixer_chan(obj, 0, p, p_max_size);
|
||||
return mixer_get_left(obj->data.l);
|
||||
}
|
||||
|
||||
void print_mixerl(struct text_object *obj, char *p, int p_max_size)
|
||||
uint8_t mixerr_percentage(struct text_object *obj)
|
||||
{
|
||||
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);
|
||||
return mixer_get_right(obj->data.l);
|
||||
}
|
||||
|
||||
int check_mixer_muted(struct text_object *obj)
|
||||
|
@ -4,9 +4,9 @@
|
||||
#define MIXER_H_
|
||||
|
||||
void parse_mixer_arg(struct text_object *, const char *);
|
||||
void print_mixer(struct text_object *, char *, int);
|
||||
void print_mixerl(struct text_object *, char *, int);
|
||||
void print_mixerr(struct text_object *, char *, int);
|
||||
uint8_t mixer_percentage(struct text_object *obj);
|
||||
uint8_t mixerl_percentage(struct text_object *obj);
|
||||
uint8_t mixerr_percentage(struct text_object *obj);
|
||||
int check_mixer_muted(struct text_object *);
|
||||
|
||||
void scan_mixer_bar(struct text_object *, const char *);
|
||||
|
Loading…
Reference in New Issue
Block a user