All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Jerome Carretero <cJ@zougloub.eu>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH 1/1] aplay: print vu-meter to stderr, not stdout
Date: Sun, 06 May 2012 12:41:33 +0200	[thread overview]
Message-ID: <s5hobq1vbfm.wl%tiwai@suse.de> (raw)
In-Reply-To: <1336273801-17170-1-git-send-email-cJ@zougloub.eu>

At Sat,  5 May 2012 23:10:01 -0400,
Jerome Carretero wrote:
> 
> It allows showing the vu-meter while recording to stdout, eg:
> 
>    aplay -C -V stereo | oggenc - > out.ogg
> 
> Signed-off-by: Jerome Carretero <cJ@zougloub.eu>

I like this change, but wait for a while just to see whether anyone
has objection to change this.  This will change the behavior, so in
some cases this may break some scripting.


thanks,

Takashi

> diff --git a/aplay/aplay.c b/aplay/aplay.c
> index 1ce34c4..8462484 100644
> --- a/aplay/aplay.c
> +++ b/aplay/aplay.c
> @@ -1453,9 +1453,9 @@ static void print_vu_meter_mono(int perc, int maxperc)
>  		sprintf(line + val, "| MAX");
>  	else
>  		sprintf(line + val, "| %02i%%", maxperc);
> -	fputs(line, stdout);
> +	fputs(line, stderr);
>  	if (perc > 100)
> -		printf(_(" !clip  "));
> +		fprintf(stderr, _(" !clip  "));
>  }
>  
>  static void print_vu_meter_stereo(int *perc, int *maxperc)
> @@ -1493,7 +1493,7 @@ static void print_vu_meter_stereo(int *perc, int *maxperc)
>  			memcpy(line + bar_length, tmp, 3);
>  	}
>  	line[bar_length * 2 + 6 + 2] = 0;
> -	fputs(line, stdout);
> +	fputs(line, stderr);
>  }
>  
>  static void print_vu_meter(signed int *perc, signed int *maxperc)
> @@ -1631,9 +1631,9 @@ static void compute_max_peak(u_char *data, size_t count)
>  			if (perc[c] > maxperc[c])
>  				maxperc[c] = perc[c];
>  
> -		putchar('\r');
> +		putc('\r', stderr);
>  		print_vu_meter(perc, maxperc);
> -		fflush(stdout);
> +		fflush(stderr);
>  	}
>  	else if(verbose==3) {
>  		printf(_("Max peak (%li samples): 0x%08x "), (long)ocount, max_peak[0]);
> @@ -1642,8 +1642,8 @@ static void compute_max_peak(u_char *data, size_t count)
>  				putchar('#');
>  			else
>  				putchar(' ');
> -		printf(" %i%%\n", perc[0]);
> -		fflush(stdout);
> +		fprintf(stderr, " %i%%\n", perc[0]);
> +		fflush(stderr);
>  	}
>  }
>  
> -- 
> 1.7.10
> 

  reply	other threads:[~2012-05-06 10:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-06  3:10 [PATCH 1/1] aplay: print vu-meter to stderr, not stdout Jerome Carretero
2012-05-06 10:41 ` Takashi Iwai [this message]
2012-05-11 15:10   ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hobq1vbfm.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=cJ@zougloub.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.