comparison transform/RealTimeEffectModelTransformer.cpp @ 850:dba8a02b0413 tonioni_multi_transform

Update the rest of the transforms stuff, so now it builds and runs again
author Chris Cannam
date Mon, 02 Dec 2013 12:29:09 +0000
parents 418cd2064769
children 06579b8ffb7b
comparison
equal deleted inserted replaced
849:418cd2064769 850:dba8a02b0413
28 #include "TransformFactory.h" 28 #include "TransformFactory.h"
29 29
30 #include <iostream> 30 #include <iostream>
31 31
32 RealTimeEffectModelTransformer::RealTimeEffectModelTransformer(Input in, 32 RealTimeEffectModelTransformer::RealTimeEffectModelTransformer(Input in,
33 const Transform &transform) : 33 const Transform &t) :
34 ModelTransformer(in, transform), 34 ModelTransformer(in, t),
35 m_plugin(0) 35 m_plugin(0)
36 { 36 {
37 Transform transform(t);
38 if (!transform.getBlockSize()) {
39 transform.setBlockSize(1024);
40 m_transforms[0] = transform;
41 }
42
37 m_units = TransformFactory::getInstance()->getTransformUnits 43 m_units = TransformFactory::getInstance()->getTransformUnits
38 (transform.getIdentifier()); 44 (transform.getIdentifier());
39 m_outputNo = 45 m_outputNo =
40 (transform.getOutput() == "A") ? -1 : transform.getOutput().toInt(); 46 (transform.getOutput() == "A") ? -1 : transform.getOutput().toInt();
41 47
42 QString pluginId = transform.getPluginIdentifier(); 48 QString pluginId = transform.getPluginIdentifier();
43 49
44 if (!m_transform.getBlockSize()) m_transform.setBlockSize(1024);
45
46 // SVDEBUG << "RealTimeEffectModelTransformer::RealTimeEffectModelTransformer: plugin " << pluginId << ", output " << output << endl; 50 // SVDEBUG << "RealTimeEffectModelTransformer::RealTimeEffectModelTransformer: plugin " << pluginId << ", output " << output << endl;
47 51
48 RealTimePluginFactory *factory = 52 RealTimePluginFactory *factory =
49 RealTimePluginFactory::instanceFor(pluginId); 53 RealTimePluginFactory::instanceFor(pluginId);
50 54
57 DenseTimeValueModel *input = getConformingInput(); 61 DenseTimeValueModel *input = getConformingInput();
58 if (!input) return; 62 if (!input) return;
59 63
60 m_plugin = factory->instantiatePlugin(pluginId, 0, 0, 64 m_plugin = factory->instantiatePlugin(pluginId, 0, 0,
61 input->getSampleRate(), 65 input->getSampleRate(),
62 m_transform.getBlockSize(), 66 transform.getBlockSize(),
63 input->getChannelCount()); 67 input->getChannelCount());
64 68
65 if (!m_plugin) { 69 if (!m_plugin) {
66 cerr << "RealTimeEffectModelTransformer: Failed to instantiate plugin \"" 70 cerr << "RealTimeEffectModelTransformer: Failed to instantiate plugin \""
67 << pluginId << "\"" << endl; 71 << pluginId << "\"" << endl;
68 return; 72 return;
69 } 73 }
70 74
71 TransformFactory::getInstance()->setPluginParameters(m_transform, m_plugin); 75 TransformFactory::getInstance()->setPluginParameters(transform, m_plugin);
72 76
73 if (m_outputNo >= 0 && 77 if (m_outputNo >= 0 &&
74 m_outputNo >= int(m_plugin->getControlOutputCount())) { 78 m_outputNo >= int(m_plugin->getControlOutputCount())) {
75 cerr << "RealTimeEffectModelTransformer: Plugin has fewer than desired " << m_outputNo << " control outputs" << endl; 79 cerr << "RealTimeEffectModelTransformer: Plugin has fewer than desired " << m_outputNo << " control outputs" << endl;
76 return; 80 return;
89 m_outputs.push_back(model); 93 m_outputs.push_back(model);
90 94
91 } else { 95 } else {
92 96
93 SparseTimeValueModel *model = new SparseTimeValueModel 97 SparseTimeValueModel *model = new SparseTimeValueModel
94 (input->getSampleRate(), m_transform.getBlockSize(), 0.0, 0.0, false); 98 (input->getSampleRate(), transform.getBlockSize(), 0.0, 0.0, false);
95 99
96 if (m_units != "") model->setScaleUnits(m_units); 100 if (m_units != "") model->setScaleUnits(m_units);
97 101
98 m_outputs.push_back(model); 102 m_outputs.push_back(model);
99 } 103 }
141 145
142 float **inbufs = m_plugin->getAudioInputBuffers(); 146 float **inbufs = m_plugin->getAudioInputBuffers();
143 147
144 long startFrame = m_input.getModel()->getStartFrame(); 148 long startFrame = m_input.getModel()->getStartFrame();
145 long endFrame = m_input.getModel()->getEndFrame(); 149 long endFrame = m_input.getModel()->getEndFrame();
150
151 Transform transform = m_transforms[0];
146 152
147 RealTime contextStartRT = m_transform.getStartTime(); 153 RealTime contextStartRT = transform.getStartTime();
148 RealTime contextDurationRT = m_transform.getDuration(); 154 RealTime contextDurationRT = transform.getDuration();
149 155
150 long contextStart = 156 long contextStart =
151 RealTime::realTime2Frame(contextStartRT, sampleRate); 157 RealTime::realTime2Frame(contextStartRT, sampleRate);
152 158
153 long contextDuration = 159 long contextDuration =