ref: 7672dd349f386c937b4858a074fa830471dbf7ee
parent: f52cfb29110cd62e70496b2a7b91107f2e988637
author: Ulrich Klauer <ulrich@chirlu.de>
date: Thu Jan 31 20:19:23 EST 2013
pad: use lsx_parseposition Use the new lsx_parseposition function for the pad effect and update the documentation accordingly.
--- a/sox.1
+++ b/sox.1
@@ -2519,7 +2519,7 @@
The \fIcolour\fR parameter controls the amount of even harmonic content
in the over-driven output.
.TP
-\fBpad\fR { \fIlength\fR[\fB@\fIposition\fR] }
+\fBpad\fR { \fIlength\fR[\fB@\fIposition(=)\fR] }
Pad the audio with silence, at the beginning, the end, or any
specified points through the audio.
.I length
--- a/src/pad.c
+++ b/src/pad.c
@@ -35,6 +35,10 @@
priv_t * p = (priv_t *)effp->priv;
char const * next;
unsigned i;
+ uint64_t last_seen = 0;
+ const uint64_t in_length = argv ? 0 :
+ (effp->in_signal.length != SOX_UNKNOWN_LEN ?
+ effp->in_signal.length / effp->in_signal.channels : SOX_UNKNOWN_LEN);
for (i = 0; i < p->npads; ++i) {
if (argv) /* 1st parse only */
@@ -45,8 +49,12 @@
p->pads[i].start = i? UINT64_MAX : 0;
else {
if (*next != '@') break;
- next = lsx_parsesamples(rate, next+1, &p->pads[i].start, 't');
+ next = lsx_parseposition(rate, next+1, argv ? NULL : &p->pads[i].start,
+ last_seen, in_length, '=');
if (next == NULL || *next != '\0') break;
+ last_seen = p->pads[i].start;
+ if (p->pads[i].start == SOX_UNKNOWN_LEN)
+ p->pads[i].start = UINT64_MAX; /* currently the same value, but ... */
}
if (!argv) {
/* Do this check only during the second pass when the actual