Mercurial > hg > sonic-visualiser
comparison transform/RealTimePluginTransform.cpp @ 178:3e5a32a2acf4
* 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)
author | Chris Cannam |
---|---|
date | Wed, 05 Sep 2007 15:18:15 +0000 |
parents | 107ca17594c8 |
children | ebd906049fb6 |
comparison
equal
deleted
inserted
replaced
177:5bde373ad5ca | 178:3e5a32a2acf4 |
---|---|
148 | 148 |
149 size_t prevCompletion = 0; | 149 size_t prevCompletion = 0; |
150 | 150 |
151 size_t latency = m_plugin->getLatency(); | 151 size_t latency = m_plugin->getLatency(); |
152 | 152 |
153 while (blockFrame < endFrame && !m_abandoned) { | 153 while (blockFrame < endFrame + latency && !m_abandoned) { |
154 | 154 |
155 size_t completion = | 155 size_t completion = |
156 (((blockFrame - startFrame) / blockSize) * 99) / | 156 (((blockFrame - startFrame) / blockSize) * 99) / |
157 ( (endFrame - startFrame) / blockSize); | 157 ( (endFrame - startFrame) / blockSize); |
158 | 158 |
220 float **outbufs = m_plugin->getAudioOutputBuffers(); | 220 float **outbufs = m_plugin->getAudioOutputBuffers(); |
221 | 221 |
222 if (outbufs) { | 222 if (outbufs) { |
223 | 223 |
224 if (blockFrame >= latency) { | 224 if (blockFrame >= latency) { |
225 wwfm->addSamples(outbufs, blockSize); | 225 size_t writeSize = std::min(blockSize, |
226 endFrame + latency - blockFrame); | |
227 wwfm->addSamples(outbufs, writeSize); | |
226 } else if (blockFrame + blockSize >= latency) { | 228 } else if (blockFrame + blockSize >= latency) { |
227 size_t offset = latency - blockFrame; | 229 size_t offset = latency - blockFrame; |
228 size_t count = blockSize - offset; | 230 size_t count = blockSize - offset; |
229 float **tmp = new float *[channelCount]; | 231 float **tmp = new float *[channelCount]; |
230 for (size_t c = 0; c < channelCount; ++c) { | 232 for (size_t c = 0; c < channelCount; ++c) { |