shithub: sox

Download patch

ref: 9279a48c30d0b7dc00018525ad1a58bd95b34b0a
parent: 9efe110d8320d941d82ab004320f973963743973
author: Ulrich Klauer <ulrich@chirlu.de>
date: Sun Jan 1 18:59:36 EST 2012

pad effect: fix a syntax checking corner case

In certain cases when time-based and sample-based position
specifications were mixed, pad could reject valid parameters or
accept invalid ones, due to using a dummy sample rate. Postpone
the check to when the actual sample rate is known.

--- a/src/pad.c
+++ b/src/pad.c
@@ -48,7 +48,14 @@
       next = lsx_parsesamples(rate, next+1, &p->pads[i].start, 't');
       if (next == NULL || *next != '\0') break;
     }
-    if (i > 0 && p->pads[i].start <= p->pads[i-1].start) break;
+    if (!argv) {
+      /* Do this check only during the second pass when the actual
+         sample rate is known, otherwise it might fail on legal
+         commands like
+           pad 1@5 1@30000s
+         if the rate is, e.g., 48k. */
+      if (i > 0 && p->pads[i].start <= p->pads[i-1].start) break;
+    }
   }
   if (i < p->npads)
     return lsx_usage(effp);