Mercurial > hg > svcore
comparison transform/ModelTransformerFactory.cpp @ 1225:ba16388b937d piper
Restore native-Vamp factory and make the choice between Piper and Native a preference
author | Chris Cannam |
---|---|
date | Fri, 21 Oct 2016 11:49:27 +0100 |
parents | 6ea7761a418b |
children | a99641535e02 |
comparison
equal
deleted
inserted
replaced
1224:ab050519c4ba | 1225:ba16388b937d |
---|---|
91 | 91 |
92 cerr << "last configuration: " << configurationXml << endl; | 92 cerr << "last configuration: " << configurationXml << endl; |
93 | 93 |
94 Vamp::PluginBase *plugin = 0; | 94 Vamp::PluginBase *plugin = 0; |
95 | 95 |
96 if (FeatureExtractionPluginFactory::instanceFor(id)) { | 96 if (RealTimePluginFactory::instanceFor(id)) { |
97 | |
98 cerr << "getConfigurationForTransform: instantiating Vamp plugin" << endl; | |
99 | |
100 Vamp::Plugin *vp = | |
101 FeatureExtractionPluginFactory::instanceFor(id)->instantiatePlugin | |
102 (id, float(inputModel->getSampleRate())); | |
103 | |
104 plugin = vp; | |
105 | |
106 } else if (RealTimePluginFactory::instanceFor(id)) { | |
107 | 97 |
108 RealTimePluginFactory *factory = RealTimePluginFactory::instanceFor(id); | 98 RealTimePluginFactory *factory = RealTimePluginFactory::instanceFor(id); |
109 | 99 |
110 sv_samplerate_t sampleRate = inputModel->getSampleRate(); | 100 sv_samplerate_t sampleRate = inputModel->getSampleRate(); |
111 int blockSize = 1024; | 101 int blockSize = 1024; |
118 | 108 |
119 RealTimePluginInstance *rtp = factory->instantiatePlugin | 109 RealTimePluginInstance *rtp = factory->instantiatePlugin |
120 (id, 0, 0, sampleRate, blockSize, channels); | 110 (id, 0, 0, sampleRate, blockSize, channels); |
121 | 111 |
122 plugin = rtp; | 112 plugin = rtp; |
113 | |
114 } else { | |
115 | |
116 cerr << "getConfigurationForTransform: instantiating Vamp plugin" << endl; | |
117 | |
118 Vamp::Plugin *vp = | |
119 FeatureExtractionPluginFactory::instance()->instantiatePlugin | |
120 (id, float(inputModel->getSampleRate())); | |
121 | |
122 plugin = vp; | |
123 } | 123 } |
124 | 124 |
125 if (plugin) { | 125 if (plugin) { |
126 | 126 |
127 // Ensure block size etc are valid | 127 // Ensure block size etc are valid |
169 { | 169 { |
170 ModelTransformer *transformer = 0; | 170 ModelTransformer *transformer = 0; |
171 | 171 |
172 QString id = transforms[0].getPluginIdentifier(); | 172 QString id = transforms[0].getPluginIdentifier(); |
173 | 173 |
174 if (FeatureExtractionPluginFactory::instanceFor(id)) { | 174 if (RealTimePluginFactory::instanceFor(id)) { |
175 | |
176 transformer = | |
177 new RealTimeEffectModelTransformer(input, transforms[0]); | |
178 | |
179 } else { | |
175 | 180 |
176 transformer = | 181 transformer = |
177 new FeatureExtractionModelTransformer(input, transforms); | 182 new FeatureExtractionModelTransformer(input, transforms); |
178 | |
179 } else if (RealTimePluginFactory::instanceFor(id)) { | |
180 | |
181 transformer = | |
182 new RealTimeEffectModelTransformer(input, transforms[0]); | |
183 | |
184 } else { | |
185 SVDEBUG << "ModelTransformerFactory::createTransformer: Unknown transform \"" | |
186 << transforms[0].getIdentifier() << "\"" << endl; | |
187 return transformer; | |
188 } | 183 } |
189 | 184 |
190 if (transformer) transformer->setObjectName(transforms[0].getIdentifier()); | 185 if (transformer) transformer->setObjectName(transforms[0].getIdentifier()); |
191 return transformer; | 186 return transformer; |
192 } | 187 } |