# HG changeset patch # User cannam # Date 1144344221 0 # Node ID 6c5466fbea903092d57eb01fd80b4dd3e067e54a # Parent b63909cbbf5790e424e87832fa622d31e13c8e26 * fix failure to pick up all but first plugin's outputs diff -r b63909cbbf57 -r 6c5466fbea90 vamp-sdk/PluginAdapter.cpp --- a/vamp-sdk/PluginAdapter.cpp Thu Apr 06 16:36:24 2006 +0000 +++ b/vamp-sdk/PluginAdapter.cpp Thu Apr 06 17:23:41 2006 +0000 @@ -123,8 +123,8 @@ if (!m_adapterMap) { m_adapterMap = new AdapterMap; - (*m_adapterMap)[&m_descriptor] = this; } + (*m_adapterMap)[&m_descriptor] = this; delete plugin; @@ -184,8 +184,15 @@ PluginAdapterBase::vampInstantiate(const VampPluginDescriptor *desc, float inputSampleRate) { - if (!m_adapterMap) return 0; - if (m_adapterMap->find(desc) == m_adapterMap->end()) return 0; + if (!m_adapterMap) { + m_adapterMap = new AdapterMap(); + } + + if (m_adapterMap->find(desc) == m_adapterMap->end()) { + std::cerr << "WARNING: PluginAdapterBase::vampInstantiate: Descriptor " << desc << " not in adapter map" << std::endl; + return 0; + } + PluginAdapterBase *adapter = (*m_adapterMap)[desc]; if (desc != &adapter->m_descriptor) return 0; @@ -296,6 +303,9 @@ PluginAdapterBase::vampGetOutputCount(VampPluginHandle handle) { PluginAdapterBase *adapter = lookupAdapter(handle); + +// std::cerr << "vampGetOutputCount: handle " << handle << " -> adapter "<< adapter << std::endl; + if (!adapter) return 0; return adapter->getOutputCount((Plugin *)handle); } @@ -305,6 +315,9 @@ unsigned int i) { PluginAdapterBase *adapter = lookupAdapter(handle); + +// std::cerr << "vampGetOutputDescriptor: handle " << handle << " -> adapter "<< adapter << std::endl; + if (!adapter) return 0; return adapter->getOutputDescriptor((Plugin *)handle, i); } @@ -392,9 +405,11 @@ void PluginAdapterBase::checkOutputMap(Plugin *plugin) { - if (!m_pluginOutputs[plugin]) { + if (m_pluginOutputs.find(plugin) == m_pluginOutputs.end() || + !m_pluginOutputs[plugin]) { m_pluginOutputs[plugin] = new Plugin::OutputList (plugin->getOutputDescriptors()); +// std::cerr << "PluginAdapterBase::checkOutputMap: Have " << m_pluginOutputs[plugin]->size() << " outputs for plugin label " << plugin->getName() << std::endl; } } diff -r b63909cbbf57 -r 6c5466fbea90 vamp-sdk/PluginHostAdapter.cpp --- a/vamp-sdk/PluginHostAdapter.cpp Thu Apr 06 16:36:24 2006 +0000 +++ b/vamp-sdk/PluginHostAdapter.cpp Thu Apr 06 17:23:41 2006 +0000 @@ -44,12 +44,16 @@ Plugin(inputSampleRate), m_descriptor(descriptor) { - std::cerr << "PluginHostAdapter::PluginHostAdapter (plugin = " << descriptor->name << ")" << std::endl; +// std::cerr << "PluginHostAdapter::PluginHostAdapter (plugin = " << descriptor->name << ")" << std::endl; m_handle = m_descriptor->instantiate(m_descriptor, inputSampleRate); + if (!m_handle) { +// std::cerr << "WARNING: PluginHostAdapter: Plugin instantiation failed for plugin " << m_descriptor->name << std::endl; + } } PluginHostAdapter::~PluginHostAdapter() { +// std::cerr << "PluginHostAdapter::~PluginHostAdapter (plugin = " << m_descriptor->name << ")" << std::endl; if (m_handle) m_descriptor->cleanup(m_handle); } @@ -215,7 +219,10 @@ PluginHostAdapter::getOutputDescriptors() const { OutputList list; - if (!m_handle) return list; + if (!m_handle) { +// std::cerr << "PluginHostAdapter::getOutputDescriptors: no handle " << std::endl; + return list; + } unsigned int count = m_descriptor->getOutputCount(m_handle);