shithub: sox

Download patch

ref: eb5b65ecefe16e176acaf5e7d6e95292c1122f76
parent: 68127910df453e134bf18fc55146a00bf12725a4
author: Ulrich Klauer <ulrich@chirlu.de>
date: Fri Aug 31 21:44:29 EDT 2012

spectrogram: fix default length regression

If the input length is not known, make 8 seconds the default length of
a spectrogram again. Previously, an empty spectrogram would be
generated.

This was a regression in 14.4.0 compared to 14.3.2, caused by changing
the "unknown length" indicator from 0 to SOX_UNKNOWN_LEN; spectrogram
still tested for 0.

--- a/ChangeLog
+++ b/ChangeLog
@@ -27,6 +27,11 @@
   o Check whether pulseaudio is available before choosing it as
     default. (robs)
 
+Effects:
+
+  o Restore 8 seconds default for spectrogram, if the input length is
+    not known. (Ulrich Klauer)
+
 Other bug fixes:
 
   o Fix input length calculation for combine methods other than
--- a/src/spectrogram.c
+++ b/src/spectrogram.c
@@ -204,7 +204,7 @@
       pixels_per_sec = min(5000, p->x_size / duration);
     else if (!p->x_size && pixels_per_sec && duration)
       p->x_size = min(5000, (int)(pixels_per_sec * duration + .5));
-    if (!duration && effp->in_signal.length) {
+    if (!duration && effp->in_signal.length != SOX_UNKNOWN_LEN) {
       duration = effp->in_signal.length / (effp->in_signal.rate * effp->in_signal.channels);
       duration -= p->start_time;
       if (duration <= 0)