shithub: sox

Download patch

ref: b458f5c10b26f3b236c535d856274fa1650e137a
parent: ab10d9bacdea137e452ca90d8872dbfa8e5f41d2
author: robs <robs>
date: Fri May 8 01:13:11 EDT 2009

make synth 0 do the right thing

--- a/src/synth.c
+++ b/src/synth.c
@@ -381,6 +381,16 @@
 
 
 
+static int flow_null(sox_effect_t * effp, const sox_sample_t * ibuf,
+    sox_sample_t * obuf, size_t * isamp, size_t * osamp)
+{
+  (void)effp, (void)ibuf, (void)obuf;
+  *isamp = *osamp = 0;
+  return SOX_EOF;
+}
+
+
+
 static int start(sox_effect_t * effp)
 {
   priv_t * p = (priv_t *)effp->priv;
@@ -388,9 +398,14 @@
 
   p->samples_done = 0;
 
-  if (p->length_str)
+  if (p->length_str) {
     if (lsx_parsesamples(effp->in_signal.rate, p->length_str, &p->samples_to_do, 't') == NULL)
       return lsx_usage(effp);
+    if (!p->samples_to_do) {
+      effp->handler.flow = flow_null;
+      return SOX_SUCCESS;
+    }
+  }
 
   p->number_of_channels = effp->in_signal.channels;
   p->channels = lsx_calloc(p->number_of_channels, sizeof(*p->channels));