diff audio/AudioGenerator.cpp @ 649:284cb118368e single-point

Further updates for new API - but we still need some more support in the API itself
author Chris Cannam
date Tue, 19 Mar 2019 13:06:58 +0000
parents 3168deb50199
children ed9cb577eb7c
line wrap: on
line diff
--- a/audio/AudioGenerator.cpp	Fri Mar 15 14:24:46 2019 +0000
+++ b/audio/AudioGenerator.cpp	Tue Mar 19 13:06:58 2019 +0000
@@ -712,36 +712,31 @@
             bufferIndexes[c] = buffer[c] + i * m_processingBlockSize;
         }
 
-        SparseTimeValueModel::PointList points = 
-            stvm->getPoints(reqStart, reqStart + m_processingBlockSize);
+        EventVector points = 
+            stvm->getEventsStartingWithin(reqStart, m_processingBlockSize);
 
         // by default, repeat last frequency
         float f0 = 0.f;
 
-        // go straight to the last freq that is genuinely in this range
-        for (SparseTimeValueModel::PointList::const_iterator itr = points.end();
-             itr != points.begin(); ) {
-            --itr;
-            if (itr->frame >= reqStart &&
-                itr->frame < reqStart + m_processingBlockSize) {
-                f0 = itr->value;
-                break;
-            }
+        // go straight to the last freq in this range
+        if (!points.empty()) {
+            f0 = points.rbegin()->getValue();
         }
 
-        // if we found no such frequency and the next point is further
+        // if there is 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)
+        /*!!! todo: restore
         if (f0 == 0.f) {
-            SparseTimeValueModel::PointList nextPoints = 
+            EventVector 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,