# HG changeset patch # User Chris Cannam # Date 1189005495 0 # Node ID 3e5a32a2acf471b22b68d8b6eda525f585bcb05a # Parent 5bde373ad5cafd19333bee8528ab4a0fb23134f5 * Ensure transformed version of a model is the same duration as the original model (don't end it when the input data runs out, as was previously done, because this will result in too short a model when latency compensation is used) diff -r 5bde373ad5ca -r 3e5a32a2acf4 transform/RealTimePluginTransform.cpp --- a/transform/RealTimePluginTransform.cpp Thu Aug 16 16:47:07 2007 +0000 +++ b/transform/RealTimePluginTransform.cpp Wed Sep 05 15:18:15 2007 +0000 @@ -150,7 +150,7 @@ size_t latency = m_plugin->getLatency(); - while (blockFrame < endFrame && !m_abandoned) { + while (blockFrame < endFrame + latency && !m_abandoned) { size_t completion = (((blockFrame - startFrame) / blockSize) * 99) / @@ -222,7 +222,9 @@ if (outbufs) { if (blockFrame >= latency) { - wwfm->addSamples(outbufs, blockSize); + size_t writeSize = std::min(blockSize, + endFrame + latency - blockFrame); + wwfm->addSamples(outbufs, writeSize); } else if (blockFrame + blockSize >= latency) { size_t offset = latency - blockFrame; size_t count = blockSize - offset;