ref: 28303e73b9099ada0b5cd7ae8520b3658f571315
parent: 792d710ec4919125a913e32de1ed8b0862c8d1ca
author: Ulrich Klauer <ulrich@chirlu.de>
date: Tue Sep 27 08:28:26 EDT 2011
Fix newfile/restart in connection with merging, mixing Constructs like sox ... trim 0 20 : newfile : restart didn't work when there were multiple parallel input files, as in sox -M in1.wav in2.wav out.wav trim 0 20 : newfile : restart This would stop after the first output file due to the main processing loop noticing that !(current_input < input_count), because current_input was increased for every block of input samples when a parallel combine method was in effect. Now current_input is increased only when an input EOF condition occurs.
--- a/src/sox.c
+++ b/src/sox.c
@@ -564,7 +564,6 @@
*p++ = (ws < z->ilen[i]) * z->ibuf[i][ws * files[i]->ft->signal.channels + s];
} /* sox_merge */
} /* wide samples */
- current_input += input_count;
} /* is_parallel */
read_wide_samples += olen;
olen *= effp->in_signal.channels;
@@ -571,6 +570,9 @@
*osamp = olen;
input_eof = olen ? sox_false : sox_true;
+
+ if (input_eof && is_parallel(combine_method))
+ current_input += input_count;
return olen? SOX_SUCCESS : SOX_EOF;
}