# HG changeset patch # User Chris Cannam # Date 1389187190 0 # Node ID 817ad10f91d1089e39cc9bb444006568d11da2e0 # Parent 58582119c92a2c23d08cd8847967e3e7f8ec8f27 Silence playback when nothing is going on diff -r 58582119c92a -r 817ad10f91d1 audioio/AudioGenerator.cpp --- 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,