ref: cb3887225cee68ff4575fb2de1cc8c67e5f96a74
parent: 221486c5526d96794e5257e55b2b07459861225f
author: robs <robs>
date: Sat Feb 17 10:44:35 EST 2007
Status line improvement fix
--- a/src/sox.c
+++ b/src/sox.c
@@ -1023,12 +1023,14 @@
do {
efftab[0].olen = 0;
if (combine_method <= SOX_concatenate) {
- if (user_skip) {
- user_skip = st_false;
- fprintf(stderr, "\nSkipped.");
- } else efftab[0].olen =
- st_read_wide(files[current_input]->desc, efftab[0].obuf);
+ if (!user_skip)
+ efftab[0].olen = st_read_wide(files[current_input]->desc, efftab[0].obuf);
if (efftab[0].olen == 0) { /* If EOF, go to the next input file. */
+ update_status(st_true);
+ if (user_skip) {
+ user_skip = st_false;
+ fprintf(stderr, "Skipped.\n");
+ }
if (++current_input < input_count) {
if (combine_method == SOX_sequence && !can_segue(current_input))
break;
@@ -1067,12 +1069,9 @@
efftab[0].odone = 0;
read_wide_samples += efftab[0].olen;
efftab[0].olen *= combiner.channels;
-
flowstatus = flow_effect_out();
+ update_status(user_abort || ofile->desc->st_errno || flowstatus);
- if (show_progress)
- update_status(st_false);
-
/* Quit reading/writing on user aborts. This will close
* the files nicely as if an EOF was reached on read. */
if (user_abort)
@@ -1087,9 +1086,6 @@
if (ofile->desc->st_errno == 0)
drain_effect_out();
- if (show_progress)
- update_status(st_true);
-
if (combine_method > SOX_concatenate)
/* Free input buffers now that they are not used */
for (i = 0; i < input_count; i++)
@@ -1676,6 +1672,8 @@
static void update_status(st_bool all_done)
{
static struct timeval then;
+ if (!show_progress)
+ return;
if (all_done || since(&then, .15, st_false)) {
double read_time = (double)read_wide_samples / combiner.rate;
double left_time = 0, in_time = 0, percentage = 0;
@@ -1690,7 +1688,7 @@
sigfigs3p(percentage), sigfigs3(output_samples), sigfigs3(total_clips()));
}
if (all_done)
- fputs("\n\n", stderr);
+ fputc('\n', stderr);
}
static int strcmp_p(const void *p1, const void *p2)