changeset 314:817ad10f91d1 tonioni

Silence playback when nothing is going on
author Chris Cannam
date Wed, 08 Jan 2014 13:19:50 +0000
parents 58582119c92a
children 65b75e23bbd5
files audioio/AudioGenerator.cpp
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/audioio/AudioGenerator.cpp	Wed Jan 08 13:07:22 2014 +0000
+++ b/audioio/AudioGenerator.cpp	Wed Jan 08 13:19:50 2014 +0000
@@ -639,6 +639,19 @@
             }
         }
 
+        // if we found no such frequency and the next point is further
+        // away than twice the model resolution, go silent (same
+        // criterion TimeValueLayer uses for ending a discrete curve
+        // segment)
+        if (f0 == 0.f) {
+            SparseTimeValueModel::PointList nextPoints = 
+                stvm->getNextPoints(reqStart + m_processingBlockSize);
+            if (nextPoints.empty() ||
+                nextPoints.begin()->frame > reqStart + 2 * stvm->getResolution()) {
+                f0 = -1.f;
+            }
+        }
+
         cerr << "f0 = " << f0 << endl;
 
         synth->mix(bufferIndexes,