Mercurial > hg > vamp-plugin-sdk
comparison vamp-sdk/PluginAdapter.cpp @ 15:6c5466fbea90
* fix failure to pick up all but first plugin's outputs
author | cannam |
---|---|
date | Thu, 06 Apr 2006 17:23:41 +0000 |
parents | 85801331454c |
children | 61887dda7fe0 |
comparison
equal
deleted
inserted
replaced
14:b63909cbbf57 | 15:6c5466fbea90 |
---|---|
121 m_descriptor.getRemainingFeatures = vampGetRemainingFeatures; | 121 m_descriptor.getRemainingFeatures = vampGetRemainingFeatures; |
122 m_descriptor.releaseFeatureSet = vampReleaseFeatureSet; | 122 m_descriptor.releaseFeatureSet = vampReleaseFeatureSet; |
123 | 123 |
124 if (!m_adapterMap) { | 124 if (!m_adapterMap) { |
125 m_adapterMap = new AdapterMap; | 125 m_adapterMap = new AdapterMap; |
126 (*m_adapterMap)[&m_descriptor] = this; | 126 } |
127 } | 127 (*m_adapterMap)[&m_descriptor] = this; |
128 | 128 |
129 delete plugin; | 129 delete plugin; |
130 | 130 |
131 m_populated = true; | 131 m_populated = true; |
132 return &m_descriptor; | 132 return &m_descriptor; |
182 | 182 |
183 VampPluginHandle | 183 VampPluginHandle |
184 PluginAdapterBase::vampInstantiate(const VampPluginDescriptor *desc, | 184 PluginAdapterBase::vampInstantiate(const VampPluginDescriptor *desc, |
185 float inputSampleRate) | 185 float inputSampleRate) |
186 { | 186 { |
187 if (!m_adapterMap) return 0; | 187 if (!m_adapterMap) { |
188 if (m_adapterMap->find(desc) == m_adapterMap->end()) return 0; | 188 m_adapterMap = new AdapterMap(); |
189 } | |
190 | |
191 if (m_adapterMap->find(desc) == m_adapterMap->end()) { | |
192 std::cerr << "WARNING: PluginAdapterBase::vampInstantiate: Descriptor " << desc << " not in adapter map" << std::endl; | |
193 return 0; | |
194 } | |
195 | |
189 PluginAdapterBase *adapter = (*m_adapterMap)[desc]; | 196 PluginAdapterBase *adapter = (*m_adapterMap)[desc]; |
190 if (desc != &adapter->m_descriptor) return 0; | 197 if (desc != &adapter->m_descriptor) return 0; |
191 | 198 |
192 Plugin *plugin = adapter->createPlugin(inputSampleRate); | 199 Plugin *plugin = adapter->createPlugin(inputSampleRate); |
193 if (plugin) { | 200 if (plugin) { |
294 | 301 |
295 unsigned int | 302 unsigned int |
296 PluginAdapterBase::vampGetOutputCount(VampPluginHandle handle) | 303 PluginAdapterBase::vampGetOutputCount(VampPluginHandle handle) |
297 { | 304 { |
298 PluginAdapterBase *adapter = lookupAdapter(handle); | 305 PluginAdapterBase *adapter = lookupAdapter(handle); |
306 | |
307 // std::cerr << "vampGetOutputCount: handle " << handle << " -> adapter "<< adapter << std::endl; | |
308 | |
299 if (!adapter) return 0; | 309 if (!adapter) return 0; |
300 return adapter->getOutputCount((Plugin *)handle); | 310 return adapter->getOutputCount((Plugin *)handle); |
301 } | 311 } |
302 | 312 |
303 VampOutputDescriptor * | 313 VampOutputDescriptor * |
304 PluginAdapterBase::vampGetOutputDescriptor(VampPluginHandle handle, | 314 PluginAdapterBase::vampGetOutputDescriptor(VampPluginHandle handle, |
305 unsigned int i) | 315 unsigned int i) |
306 { | 316 { |
307 PluginAdapterBase *adapter = lookupAdapter(handle); | 317 PluginAdapterBase *adapter = lookupAdapter(handle); |
318 | |
319 // std::cerr << "vampGetOutputDescriptor: handle " << handle << " -> adapter "<< adapter << std::endl; | |
320 | |
308 if (!adapter) return 0; | 321 if (!adapter) return 0; |
309 return adapter->getOutputDescriptor((Plugin *)handle, i); | 322 return adapter->getOutputDescriptor((Plugin *)handle, i); |
310 } | 323 } |
311 | 324 |
312 void | 325 void |
390 } | 403 } |
391 | 404 |
392 void | 405 void |
393 PluginAdapterBase::checkOutputMap(Plugin *plugin) | 406 PluginAdapterBase::checkOutputMap(Plugin *plugin) |
394 { | 407 { |
395 if (!m_pluginOutputs[plugin]) { | 408 if (m_pluginOutputs.find(plugin) == m_pluginOutputs.end() || |
409 !m_pluginOutputs[plugin]) { | |
396 m_pluginOutputs[plugin] = new Plugin::OutputList | 410 m_pluginOutputs[plugin] = new Plugin::OutputList |
397 (plugin->getOutputDescriptors()); | 411 (plugin->getOutputDescriptors()); |
412 // std::cerr << "PluginAdapterBase::checkOutputMap: Have " << m_pluginOutputs[plugin]->size() << " outputs for plugin label " << plugin->getName() << std::endl; | |
398 } | 413 } |
399 } | 414 } |
400 | 415 |
401 unsigned int | 416 unsigned int |
402 PluginAdapterBase::getOutputCount(Plugin *plugin) | 417 PluginAdapterBase::getOutputCount(Plugin *plugin) |