Mercurial > hg > sonic-visualiser
diff transform/RealTimePluginTransform.cpp @ 55:ca1e3f5657d5
* Simplify maker names in plugin menu
* Make sure derived models have a name (based on the transform)
* Don't start deriving a model from a derived model until the derived model is
ready
* Tidy up completion management in writable wave file model
* Make writable models save/reload correctly from session file (i.e.
regenerating from the original transform)
* Same for dense 3d models -- don't save the data, just the transform details
* Add a comment describing the SV file format
author | Chris Cannam |
---|---|
date | Fri, 13 Oct 2006 12:51:05 +0000 (2006-10-13) |
parents | 527598e2fa10 |
children | bedc7517b6e8 |
line wrap: on
line diff
--- a/transform/RealTimePluginTransform.cpp Thu Oct 12 14:56:28 2006 +0000 +++ b/transform/RealTimePluginTransform.cpp Fri Oct 13 12:51:05 2006 +0000 @@ -24,6 +24,7 @@ #include "data/model/SparseTimeValueModel.h" #include "data/model/DenseTimeValueModel.h" #include "data/model/WritableWaveFileModel.h" +#include "data/model/WaveFileModel.h" #include <iostream> @@ -118,6 +119,12 @@ DenseTimeValueModel *input = getInput(); if (!input) return; + while (!input->isReady()) { + if (dynamic_cast<WaveFileModel *>(input)) break; // no need to wait + std::cerr << "FeatureExtractionPluginTransform::run: Waiting for input model to be ready..." << std::endl; + sleep(1); + } + SparseTimeValueModel *stvm = dynamic_cast<SparseTimeValueModel *>(m_output); WritableWaveFileModel *wwfm = dynamic_cast<WritableWaveFileModel *>(m_output); if (!stvm && !wwfm) return; @@ -195,10 +202,6 @@ if (buffers) { - //!!! This will fail if any buffers[c] is null or - //uninitialised. The plugin instance should ensure - //that that can't happen -- but it doesn't - if (blockFrame >= latency) { wwfm->addSamples(buffers, blockSize); } else if (blockFrame + blockSize >= latency) { @@ -216,6 +219,7 @@ if (blockFrame == startFrame || completion > prevCompletion) { if (stvm) stvm->setCompletion(completion); + if (wwfm) wwfm->setCompletion(completion); prevCompletion = completion; } @@ -223,6 +227,6 @@ } if (stvm) stvm->setCompletion(100); - if (wwfm) wwfm->sync(); + if (wwfm) wwfm->setCompletion(100); }