56 cerr <<
"RealTimeEffectModelTransformer: No factory available for plugin id \"" 57 << pluginId <<
"\"" << endl;
70 cerr <<
"RealTimeEffectModelTransformer: Failed to instantiate plugin \"" 71 << pluginId <<
"\"" << endl;
79 cerr <<
"RealTimeEffectModelTransformer: Plugin has fewer than desired " <<
m_outputNo <<
" control outputs" << endl;
117 SVDEBUG <<
"RealTimeEffectModelTransformer::getConformingInput: WARNING: Input model is not conformable to DenseTimeValueModel" << endl;
129 SVDEBUG <<
"RealTimeEffectModelTransformer::run: Waiting for input model to be ready..." << endl;
136 if (!stvm && !wwfm)
return;
159 long contextDuration =
162 if (contextStart == 0 || contextStart < startFrame) {
163 contextStart = startFrame;
166 if (contextDuration == 0) {
167 contextDuration = endFrame - contextStart;
169 if (contextStart + contextDuration > endFrame) {
170 contextDuration = endFrame - contextStart;
177 long blockFrame = contextStart;
179 long prevCompletion = 0;
183 while (blockFrame < contextStart + contextDuration + latency &&
187 (((blockFrame - contextStart) / blockSize) * 99) /
188 (1 + ((contextDuration) / blockSize));
192 if (channelCount == 1) {
193 if (inbufs && inbufs[0]) {
196 while (got < blockSize) {
197 inbufs[0][got++] = 0.0;
200 for (
long i = 0; i < blockSize; ++i) {
201 inbufs[ch][i] = inbufs[0][i];
206 if (inbufs && inbufs[0]) {
207 got = input->
getData(0, channelCount - 1,
208 blockFrame, blockSize,
210 while (got < blockSize) {
211 for (
int ch = 0; ch < channelCount; ++ch) {
212 inbufs[ch][got] = 0.0;
217 for (
long i = 0; i < blockSize; ++i) {
218 inbufs[ch][i] = inbufs[ch % channelCount][i];
238 m_plugin->
run(Vamp::RealTime::frame2RealTime(blockFrame, sampleRate));
244 long pointFrame = blockFrame;
245 if (pointFrame > latency) pointFrame -= latency;
249 (pointFrame, value,
""));
257 if (blockFrame >= latency) {
258 long writeSize = std::min
260 contextStart + contextDuration + latency - blockFrame);
262 }
else if (blockFrame + blockSize >= latency) {
263 long offset = latency - blockFrame;
264 long count = blockSize - offset;
265 float **tmp =
new float *[channelCount];
266 for (
int c = 0; c < channelCount; ++c) {
267 tmp[c] = outbufs[c] + offset;
275 if (blockFrame == contextStart || completion > prevCompletion) {
278 prevCompletion = completion;
281 blockFrame += blockSize;
virtual int getChannelCount() const =0
Return the number of distinct channels for this model.
virtual size_t getAudioInputCount() const =0
virtual size_t getLatency()=0
virtual size_t getAudioOutputCount() const =0
virtual sample_t ** getAudioOutputBuffers()=0
static RealTimePluginFactory * instanceFor(QString identifier)
virtual int getStartFrame() const =0
Return the first audio frame spanned by the model.
virtual size_t getControlOutputCount() const =0
virtual int getData(int channel, int start, int count, float *buffer) const =0
Get the specified set of samples from the given channel of the model in single-precision floating-poi...
virtual void setCompletion(int completion)
virtual bool isReady(int *completion=0) const
Return true if the model has finished loading or calculating all its data, for a model that is capabl...
Time/value point type for use in a SparseModel or SparseValueModel.
virtual void setScaleUnits(QString units)
void setStartFrame(int startFrame)
virtual void addPoint(const PointType &point)
Add a point.
virtual int getSampleRate() const =0
Return the frame rate in frames per second.
virtual sample_t ** getAudioInputBuffers()=0
virtual void run(const Vamp::RealTime &blockStartTime, size_t count=0)=0
Run for one block, starting at the given time.
virtual RealTimePluginInstance * instantiatePlugin(QString identifier, int clientId, int position, unsigned int sampleRate, unsigned int blockSize, unsigned int channels)=0
Instantiate a plugin.
Base class for models containing dense two-dimensional data (value against time).
virtual int getEndFrame() const =0
Return the last audio frame spanned by the model.
static long realTime2Frame(const RealTime &r, unsigned int sampleRate)
Convert a RealTime into a sample frame at the given sample rate.
virtual void setCompletion(int completion, bool update=true)
virtual size_t getBufferSize() const =0
virtual float getControlOutputValue(size_t n) const =0
virtual bool addSamples(float **samples, int count)
Call addSamples to append a block of samples to the end of the file.
RealTime represents time values to nanosecond precision with accurate arithmetic and frame-rate conve...