1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-25 04:06:03 +00:00

mixer: convert to common signature

This commit is contained in:
Phil Sutter 2009-11-08 16:36:35 +01:00
parent 80e41032cd
commit 91b0c66617
3 changed files with 48 additions and 10 deletions

View File

@ -1444,23 +1444,23 @@ void generate_text_internal(char *p, int p_max_size,
#endif /* X11 */
/* mixer stuff */
OBJ(mixer) {
print_mixer(obj, 0, p, p_max_size);
print_mixer(obj, p, p_max_size);
}
OBJ(mixerl) {
print_mixer(obj, -1, p, p_max_size);
print_mixerl(obj, p, p_max_size);
}
OBJ(mixerr) {
print_mixer(obj, 1, p, p_max_size);
print_mixerr(obj, p, p_max_size);
}
#ifdef X11
OBJ(mixerbar) {
print_mixer_bar(obj, 0, p);
print_mixer_bar(obj, p, p_max_size);
}
OBJ(mixerlbar) {
print_mixer_bar(obj, -1, p);
print_mixerl_bar(obj, p, p_max_size);
}
OBJ(mixerrbar) {
print_mixer_bar(obj, 1, p);
print_mixerr_bar(obj, p, p_max_size);
}
#endif /* X11 */
OBJ(if_mixer_mute) {

View File

@ -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))
@ -326,10 +341,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)
@ -339,4 +357,20 @@ void print_mixer_bar(struct text_object *obj, int chan, char *p)
new_bar(obj, p, 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 */

View File

@ -4,12 +4,16 @@
#define MIXER_H_
void parse_mixer_arg(struct text_object *, const char *);
void print_mixer(struct text_object *, int, char *, int);
void print_mixer(struct text_object *, char *, int);
void print_mixerl(struct text_object *, char *, int);
void print_mixerr(struct text_object *, char *, int);
int check_mixer_muted(struct text_object *);
#ifdef X11
void scan_mixer_bar(struct text_object *, const char *);
void print_mixer_bar(struct text_object *, int, 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);
#endif /* X11 */
#endif /*MIXER_H_*/