ref: 9b5acb4f60486cce2099af5d81625d7808eaa5fd
parent: 7c7f1b95b75bbac252b634f80b942ce54284276f
author: Ulrich Klauer <ulrich@chirlu.de>
date: Sun Jan 13 10:32:55 EST 2013
repeat: support infinite repetition The special argument "-" to repeat will cause it to repeat the audio forever. This can be combined with trim or used interactively.
--- a/ChangeLog
+++ b/ChangeLog
@@ -33,6 +33,7 @@
o Allow mixing time and sample-count arguments for the delay
effect, and for spectrogram -S and -d. (Ulrich Klauer)
o Support multi-channel LADSPA plugins. (Eric Wong)
+ o Support infinite repetition with repeat. (Ulrich Klauer)
Other new features:
--- a/sox.1
+++ b/sox.1
@@ -2918,8 +2918,9 @@
.SP
See also the \fBswap\fR effect.
.TP
-\fBrepeat\fR [\fIcount\fR (1)]
+\fBrepeat\fR [\fIcount\fR(1)|\fB\-\fR]
Repeat the entire audio \fIcount\fR times, or once if \fIcount\fR is not given.
+The special value \fB\-\fR requests infinite repetition.
Requires temporary file space to store the audio to be repeated.
Note that repeating once yields two copies: the original audio and the
repeated audio.
--- a/src/repeat.c
+++ b/src/repeat.c
@@ -29,6 +29,10 @@
priv_t * p = (priv_t *)effp->priv;
p->num_repeats = 1;
--argc, ++argv;
+ if (argc == 1 && !strcmp(*argv, "-")) {
+ p->num_repeats = UINT_MAX;
+ return SOX_SUCCESS;
+ }
do {NUMERIC_PARAMETER(num_repeats, 0, UINT_MAX - 1)} while (0);
return argc? lsx_usage(effp) : SOX_SUCCESS;
}
@@ -75,7 +79,8 @@
while ((p->remaining_samples || p->remaining_repeats) && odone < *osamp) {
if (!p->remaining_samples) {
p->remaining_samples = p->num_samples;
- --p->remaining_repeats;
+ if (p->remaining_repeats != UINT_MAX)
+ --p->remaining_repeats;
rewind(p->tmp_file);
}
n = min(p->remaining_samples, *osamp - odone);