Mercurial > hg > vamp-plugin-sdk
changeset 76:6683f99107cf
* Use m_impl structure for PluginAdapter as well
* Doc updates
author | cannam |
---|---|
date | Thu, 07 Jun 2007 14:15:24 +0000 |
parents | 0f8524203677 |
children | ba5f87117b67 |
files | vamp-sdk/Plugin.h vamp-sdk/PluginAdapter.cpp vamp-sdk/PluginAdapter.h vamp-sdk/PluginHostAdapter.h vamp-sdk/RealTime.h vamp-sdk/hostext/PluginChannelAdapter.h vamp-sdk/hostext/PluginInputDomainAdapter.h vamp-sdk/hostext/PluginLoader.h vamp-sdk/hostext/PluginWrapper.h |
diffstat | 9 files changed, 207 insertions(+), 157 deletions(-) [+] |
line wrap: on
line diff
--- a/vamp-sdk/Plugin.h Thu Jun 07 13:56:26 2007 +0000 +++ b/vamp-sdk/Plugin.h Thu Jun 07 14:15:24 2007 +0000 @@ -47,6 +47,8 @@ namespace Vamp { /** + * \class Plugin Plugin.h <vamp-sdk/Plugin.h> + * * Vamp::Plugin is a base class for plugin instance classes * that provide feature extraction from audio or related data. *
--- a/vamp-sdk/PluginAdapter.cpp Thu Jun 07 13:56:26 2007 +0000 +++ b/vamp-sdk/PluginAdapter.cpp Thu Jun 07 14:15:24 2007 +0000 @@ -41,27 +41,125 @@ namespace Vamp { -PluginAdapterBase::PluginAdapterBase() : - m_populated(false) +class PluginAdapterBase::Impl { -#ifdef DEBUG_PLUGIN_ADAPTER - std::cerr << "PluginAdapterBase[" << this << "]::PluginAdapterBase" << std::endl; -#endif +public: + Impl(PluginAdapterBase *); + ~Impl(); + + const VampPluginDescriptor *getDescriptor(); + +protected: + PluginAdapterBase *m_base; + + static VampPluginHandle vampInstantiate(const VampPluginDescriptor *desc, + float inputSampleRate); + + static void vampCleanup(VampPluginHandle handle); + + static int vampInitialise(VampPluginHandle handle, unsigned int channels, + unsigned int stepSize, unsigned int blockSize); + + static void vampReset(VampPluginHandle handle); + + static float vampGetParameter(VampPluginHandle handle, int param); + static void vampSetParameter(VampPluginHandle handle, int param, float value); + + static unsigned int vampGetCurrentProgram(VampPluginHandle handle); + static void vampSelectProgram(VampPluginHandle handle, unsigned int program); + + static unsigned int vampGetPreferredStepSize(VampPluginHandle handle); + static unsigned int vampGetPreferredBlockSize(VampPluginHandle handle); + static unsigned int vampGetMinChannelCount(VampPluginHandle handle); + static unsigned int vampGetMaxChannelCount(VampPluginHandle handle); + + static unsigned int vampGetOutputCount(VampPluginHandle handle); + + static VampOutputDescriptor *vampGetOutputDescriptor(VampPluginHandle handle, + unsigned int i); + + static void vampReleaseOutputDescriptor(VampOutputDescriptor *desc); + + static VampFeatureList *vampProcess(VampPluginHandle handle, + const float *const *inputBuffers, + int sec, + int nsec); + + static VampFeatureList *vampGetRemainingFeatures(VampPluginHandle handle); + + static void vampReleaseFeatureSet(VampFeatureList *fs); + + void cleanup(Plugin *plugin); + void checkOutputMap(Plugin *plugin); + unsigned int getOutputCount(Plugin *plugin); + VampOutputDescriptor *getOutputDescriptor(Plugin *plugin, + unsigned int i); + VampFeatureList *process(Plugin *plugin, + const float *const *inputBuffers, + int sec, int nsec); + VampFeatureList *getRemainingFeatures(Plugin *plugin); + VampFeatureList *convertFeatures(Plugin *plugin, + const Plugin::FeatureSet &features); + + // maps both plugins and descriptors to adapters + typedef std::map<const void *, Impl *> AdapterMap; + static AdapterMap *m_adapterMap; + static Impl *lookupAdapter(VampPluginHandle); + + bool m_populated; + VampPluginDescriptor m_descriptor; + Plugin::ParameterList m_parameters; + Plugin::ProgramList m_programs; + + typedef std::map<Plugin *, Plugin::OutputList *> OutputMap; + OutputMap m_pluginOutputs; + + std::map<Plugin *, VampFeatureList *> m_fs; + std::map<Plugin *, std::vector<size_t> > m_fsizes; + std::map<Plugin *, std::vector<std::vector<size_t> > > m_fvsizes; + void resizeFS(Plugin *plugin, int n); + void resizeFL(Plugin *plugin, int n, size_t sz); + void resizeFV(Plugin *plugin, int n, int j, size_t sz); +}; + +PluginAdapterBase::PluginAdapterBase() +{ + m_impl = new Impl(this); +} + +PluginAdapterBase::~PluginAdapterBase() +{ + delete m_impl; } const VampPluginDescriptor * PluginAdapterBase::getDescriptor() { + return m_impl->getDescriptor(); +} + +PluginAdapterBase::Impl::Impl(PluginAdapterBase *base) : + m_base(base), + m_populated(false) +{ #ifdef DEBUG_PLUGIN_ADAPTER - std::cerr << "PluginAdapterBase[" << this << "]::getDescriptor" << std::endl; + std::cerr << "PluginAdapterBase::Impl[" << this << "]::Impl" << std::endl; +#endif +} + +const VampPluginDescriptor * +PluginAdapterBase::Impl::getDescriptor() +{ +#ifdef DEBUG_PLUGIN_ADAPTER + std::cerr << "PluginAdapterBase::Impl[" << this << "]::getDescriptor" << std::endl; #endif if (m_populated) return &m_descriptor; - Plugin *plugin = createPlugin(48000); + Plugin *plugin = m_base->createPlugin(48000); if (plugin->getVampApiVersion() != VAMP_API_VERSION) { - std::cerr << "Vamp::PluginAdapterBase::getDescriptor: ERROR: " + std::cerr << "Vamp::PluginAdapterBase::Impl::getDescriptor: ERROR: " << "Plugin object API version " << plugin->getVampApiVersion() << " does not match actual API version " @@ -155,10 +253,10 @@ return &m_descriptor; } -PluginAdapterBase::~PluginAdapterBase() +PluginAdapterBase::Impl::~Impl() { #ifdef DEBUG_PLUGIN_ADAPTER - std::cerr << "PluginAdapterBase[" << this << "]::~PluginAdapterBase" << std::endl; + std::cerr << "PluginAdapterBase::Impl[" << this << "]::~Impl" << std::endl; #endif if (!m_populated) return; @@ -200,11 +298,11 @@ } } -PluginAdapterBase * -PluginAdapterBase::lookupAdapter(VampPluginHandle handle) +PluginAdapterBase::Impl * +PluginAdapterBase::Impl::lookupAdapter(VampPluginHandle handle) { #ifdef DEBUG_PLUGIN_ADAPTER - std::cerr << "PluginAdapterBase::lookupAdapter(" << handle << ")" << std::endl; + std::cerr << "PluginAdapterBase::Impl::lookupAdapter(" << handle << ")" << std::endl; #endif if (!m_adapterMap) return 0; @@ -214,11 +312,11 @@ } VampPluginHandle -PluginAdapterBase::vampInstantiate(const VampPluginDescriptor *desc, +PluginAdapterBase::Impl::vampInstantiate(const VampPluginDescriptor *desc, float inputSampleRate) { #ifdef DEBUG_PLUGIN_ADAPTER - std::cerr << "PluginAdapterBase::vampInstantiate(" << desc << ")" << std::endl; + std::cerr << "PluginAdapterBase::Impl::vampInstantiate(" << desc << ")" << std::endl; #endif if (!m_adapterMap) { @@ -226,33 +324,33 @@ } if (m_adapterMap->find(desc) == m_adapterMap->end()) { - std::cerr << "WARNING: PluginAdapterBase::vampInstantiate: Descriptor " << desc << " not in adapter map" << std::endl; + std::cerr << "WARNING: PluginAdapterBase::Impl::vampInstantiate: Descriptor " << desc << " not in adapter map" << std::endl; return 0; } - PluginAdapterBase *adapter = (*m_adapterMap)[desc]; + Impl *adapter = (*m_adapterMap)[desc]; if (desc != &adapter->m_descriptor) return 0; - Plugin *plugin = adapter->createPlugin(inputSampleRate); + Plugin *plugin = adapter->m_base->createPlugin(inputSampleRate); if (plugin) { (*m_adapterMap)[plugin] = adapter; } #ifdef DEBUG_PLUGIN_ADAPTER - std::cerr << "PluginAdapterBase::vampInstantiate(" << desc << "): returning handle " << plugin << std::endl; + std::cerr << "PluginAdapterBase::Impl::vampInstantiate(" << desc << "): returning handle " << plugin << std::endl; #endif return plugin; } void -PluginAdapterBase::vampCleanup(VampPluginHandle handle) +PluginAdapterBase::Impl::vampCleanup(VampPluginHandle handle) { #ifdef DEBUG_PLUGIN_ADAPTER - std::cerr << "PluginAdapterBase::vampCleanup(" << handle << ")" << std::endl; + std::cerr << "PluginAdapterBase::Impl::vampCleanup(" << handle << ")" << std::endl; #endif - PluginAdapterBase *adapter = lookupAdapter(handle); + Impl *adapter = lookupAdapter(handle); if (!adapter) { delete ((Plugin *)handle); return; @@ -261,13 +359,13 @@ } int -PluginAdapterBase::vampInitialise(VampPluginHandle handle, +PluginAdapterBase::Impl::vampInitialise(VampPluginHandle handle, unsigned int channels, unsigned int stepSize, unsigned int blockSize) { #ifdef DEBUG_PLUGIN_ADAPTER - std::cerr << "PluginAdapterBase::vampInitialise(" << handle << ", " << channels << ", " << stepSize << ", " << blockSize << ")" << std::endl; + std::cerr << "PluginAdapterBase::Impl::vampInitialise(" << handle << ", " << channels << ", " << stepSize << ", " << blockSize << ")" << std::endl; #endif bool result = ((Plugin *)handle)->initialise @@ -276,51 +374,51 @@ } void -PluginAdapterBase::vampReset(VampPluginHandle handle) +PluginAdapterBase::Impl::vampReset(VampPluginHandle handle) { #ifdef DEBUG_PLUGIN_ADAPTER - std::cerr << "PluginAdapterBase::vampReset(" << handle << ")" << std::endl; + std::cerr << "PluginAdapterBase::Impl::vampReset(" << handle << ")" << std::endl; #endif ((Plugin *)handle)->reset(); } float -PluginAdapterBase::vampGetParameter(VampPluginHandle handle, +PluginAdapterBase::Impl::vampGetParameter(VampPluginHandle handle, int param) { #ifdef DEBUG_PLUGIN_ADAPTER - std::cerr << "PluginAdapterBase::vampGetParameter(" << handle << ", " << param << ")" << std::endl; + std::cerr << "PluginAdapterBase::Impl::vampGetParameter(" << handle << ", " << param << ")" << std::endl; #endif - PluginAdapterBase *adapter = lookupAdapter(handle); + Impl *adapter = lookupAdapter(handle); if (!adapter) return 0.0; Plugin::ParameterList &list = adapter->m_parameters; return ((Plugin *)handle)->getParameter(list[param].identifier); } void -PluginAdapterBase::vampSetParameter(VampPluginHandle handle, +PluginAdapterBase::Impl::vampSetParameter(VampPluginHandle handle, int param, float value) { #ifdef DEBUG_PLUGIN_ADAPTER - std::cerr << "PluginAdapterBase::vampSetParameter(" << handle << ", " << param << ", " << value << ")" << std::endl; + std::cerr << "PluginAdapterBase::Impl::vampSetParameter(" << handle << ", " << param << ", " << value << ")" << std::endl; #endif - PluginAdapterBase *adapter = lookupAdapter(handle); + Impl *adapter = lookupAdapter(handle); if (!adapter) return; Plugin::ParameterList &list = adapter->m_parameters; ((Plugin *)handle)->setParameter(list[param].identifier, value); } unsigned int -PluginAdapterBase::vampGetCurrentProgram(VampPluginHandle handle) +PluginAdapterBase::Impl::vampGetCurrentProgram(VampPluginHandle handle) { #ifdef DEBUG_PLUGIN_ADAPTER - std::cerr << "PluginAdapterBase::vampGetCurrentProgram(" << handle << ")" << std::endl; + std::cerr << "PluginAdapterBase::Impl::vampGetCurrentProgram(" << handle << ")" << std::endl; #endif - PluginAdapterBase *adapter = lookupAdapter(handle); + Impl *adapter = lookupAdapter(handle); if (!adapter) return 0; Plugin::ProgramList &list = adapter->m_programs; std::string program = ((Plugin *)handle)->getCurrentProgram(); @@ -331,67 +429,67 @@ } void -PluginAdapterBase::vampSelectProgram(VampPluginHandle handle, +PluginAdapterBase::Impl::vampSelectProgram(VampPluginHandle handle, unsigned int program) { #ifdef DEBUG_PLUGIN_ADAPTER - std::cerr << "PluginAdapterBase::vampSelectProgram(" << handle << ", " << program << ")" << std::endl; + std::cerr << "PluginAdapterBase::Impl::vampSelectProgram(" << handle << ", " << program << ")" << std::endl; #endif - PluginAdapterBase *adapter = lookupAdapter(handle); + Impl *adapter = lookupAdapter(handle); if (!adapter) return; Plugin::ProgramList &list = adapter->m_programs; ((Plugin *)handle)->selectProgram(list[program]); } unsigned int -PluginAdapterBase::vampGetPreferredStepSize(VampPluginHandle handle) +PluginAdapterBase::Impl::vampGetPreferredStepSize(VampPluginHandle handle) { #ifdef DEBUG_PLUGIN_ADAPTER - std::cerr << "PluginAdapterBase::vampGetPreferredStepSize(" << handle << ")" << std::endl; + std::cerr << "PluginAdapterBase::Impl::vampGetPreferredStepSize(" << handle << ")" << std::endl; #endif return ((Plugin *)handle)->getPreferredStepSize(); } unsigned int -PluginAdapterBase::vampGetPreferredBlockSize(VampPluginHandle handle) +PluginAdapterBase::Impl::vampGetPreferredBlockSize(VampPluginHandle handle) { #ifdef DEBUG_PLUGIN_ADAPTER - std::cerr << "PluginAdapterBase::vampGetPreferredBlockSize(" << handle << ")" << std::endl; + std::cerr << "PluginAdapterBase::Impl::vampGetPreferredBlockSize(" << handle << ")" << std::endl; #endif return ((Plugin *)handle)->getPreferredBlockSize(); } unsigned int -PluginAdapterBase::vampGetMinChannelCount(VampPluginHandle handle) +PluginAdapterBase::Impl::vampGetMinChannelCount(VampPluginHandle handle) { #ifdef DEBUG_PLUGIN_ADAPTER - std::cerr << "PluginAdapterBase::vampGetMinChannelCount(" << handle << ")" << std::endl; + std::cerr << "PluginAdapterBase::Impl::vampGetMinChannelCount(" << handle << ")" << std::endl; #endif return ((Plugin *)handle)->getMinChannelCount(); } unsigned int -PluginAdapterBase::vampGetMaxChannelCount(VampPluginHandle handle) +PluginAdapterBase::Impl::vampGetMaxChannelCount(VampPluginHandle handle) { #ifdef DEBUG_PLUGIN_ADAPTER - std::cerr << "PluginAdapterBase::vampGetMaxChannelCount(" << handle << ")" << std::endl; + std::cerr << "PluginAdapterBase::Impl::vampGetMaxChannelCount(" << handle << ")" << std::endl; #endif return ((Plugin *)handle)->getMaxChannelCount(); } unsigned int -PluginAdapterBase::vampGetOutputCount(VampPluginHandle handle) +PluginAdapterBase::Impl::vampGetOutputCount(VampPluginHandle handle) { #ifdef DEBUG_PLUGIN_ADAPTER - std::cerr << "PluginAdapterBase::vampGetOutputCount(" << handle << ")" << std::endl; + std::cerr << "PluginAdapterBase::Impl::vampGetOutputCount(" << handle << ")" << std::endl; #endif - PluginAdapterBase *adapter = lookupAdapter(handle); + Impl *adapter = lookupAdapter(handle); // std::cerr << "vampGetOutputCount: handle " << handle << " -> adapter "<< adapter << std::endl; @@ -400,14 +498,14 @@ } VampOutputDescriptor * -PluginAdapterBase::vampGetOutputDescriptor(VampPluginHandle handle, +PluginAdapterBase::Impl::vampGetOutputDescriptor(VampPluginHandle handle, unsigned int i) { #ifdef DEBUG_PLUGIN_ADAPTER - std::cerr << "PluginAdapterBase::vampGetOutputDescriptor(" << handle << ", " << i << ")" << std::endl; + std::cerr << "PluginAdapterBase::Impl::vampGetOutputDescriptor(" << handle << ", " << i << ")" << std::endl; #endif - PluginAdapterBase *adapter = lookupAdapter(handle); + Impl *adapter = lookupAdapter(handle); // std::cerr << "vampGetOutputDescriptor: handle " << handle << " -> adapter "<< adapter << std::endl; @@ -416,10 +514,10 @@ } void -PluginAdapterBase::vampReleaseOutputDescriptor(VampOutputDescriptor *desc) +PluginAdapterBase::Impl::vampReleaseOutputDescriptor(VampOutputDescriptor *desc) { #ifdef DEBUG_PLUGIN_ADAPTER - std::cerr << "PluginAdapterBase::vampReleaseOutputDescriptor(" << desc << ")" << std::endl; + std::cerr << "PluginAdapterBase::Impl::vampReleaseOutputDescriptor(" << desc << ")" << std::endl; #endif if (desc->identifier) free((void *)desc->identifier); @@ -438,43 +536,43 @@ } VampFeatureList * -PluginAdapterBase::vampProcess(VampPluginHandle handle, +PluginAdapterBase::Impl::vampProcess(VampPluginHandle handle, const float *const *inputBuffers, int sec, int nsec) { #ifdef DEBUG_PLUGIN_ADAPTER - std::cerr << "PluginAdapterBase::vampProcess(" << handle << ", " << sec << ", " << nsec << ")" << std::endl; + std::cerr << "PluginAdapterBase::Impl::vampProcess(" << handle << ", " << sec << ", " << nsec << ")" << std::endl; #endif - PluginAdapterBase *adapter = lookupAdapter(handle); + Impl *adapter = lookupAdapter(handle); if (!adapter) return 0; return adapter->process((Plugin *)handle, inputBuffers, sec, nsec); } VampFeatureList * -PluginAdapterBase::vampGetRemainingFeatures(VampPluginHandle handle) +PluginAdapterBase::Impl::vampGetRemainingFeatures(VampPluginHandle handle) { #ifdef DEBUG_PLUGIN_ADAPTER - std::cerr << "PluginAdapterBase::vampGetRemainingFeatures(" << handle << ")" << std::endl; + std::cerr << "PluginAdapterBase::Impl::vampGetRemainingFeatures(" << handle << ")" << std::endl; #endif - PluginAdapterBase *adapter = lookupAdapter(handle); + Impl *adapter = lookupAdapter(handle); if (!adapter) return 0; return adapter->getRemainingFeatures((Plugin *)handle); } void -PluginAdapterBase::vampReleaseFeatureSet(VampFeatureList *fs) +PluginAdapterBase::Impl::vampReleaseFeatureSet(VampFeatureList *fs) { #ifdef DEBUG_PLUGIN_ADAPTER - std::cerr << "PluginAdapterBase::vampReleaseFeatureSet" << std::endl; + std::cerr << "PluginAdapterBase::Impl::vampReleaseFeatureSet" << std::endl; #endif } void -PluginAdapterBase::cleanup(Plugin *plugin) +PluginAdapterBase::Impl::cleanup(Plugin *plugin) { if (m_fs.find(plugin) != m_fs.end()) { size_t outputCount = 0; @@ -516,25 +614,25 @@ } void -PluginAdapterBase::checkOutputMap(Plugin *plugin) +PluginAdapterBase::Impl::checkOutputMap(Plugin *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 " << plugin->getIdentifier() << std::endl; +// std::cerr << "PluginAdapterBase::Impl::checkOutputMap: Have " << m_pluginOutputs[plugin]->size() << " outputs for plugin " << plugin->getIdentifier() << std::endl; } } unsigned int -PluginAdapterBase::getOutputCount(Plugin *plugin) +PluginAdapterBase::Impl::getOutputCount(Plugin *plugin) { checkOutputMap(plugin); return m_pluginOutputs[plugin]->size(); } VampOutputDescriptor * -PluginAdapterBase::getOutputDescriptor(Plugin *plugin, +PluginAdapterBase::Impl::getOutputDescriptor(Plugin *plugin, unsigned int i) { checkOutputMap(plugin); @@ -587,26 +685,26 @@ } VampFeatureList * -PluginAdapterBase::process(Plugin *plugin, +PluginAdapterBase::Impl::process(Plugin *plugin, const float *const *inputBuffers, int sec, int nsec) { -// std::cerr << "PluginAdapterBase::process" << std::endl; +// std::cerr << "PluginAdapterBase::Impl::process" << std::endl; RealTime rt(sec, nsec); checkOutputMap(plugin); return convertFeatures(plugin, plugin->process(inputBuffers, rt)); } VampFeatureList * -PluginAdapterBase::getRemainingFeatures(Plugin *plugin) +PluginAdapterBase::Impl::getRemainingFeatures(Plugin *plugin) { -// std::cerr << "PluginAdapterBase::getRemainingFeatures" << std::endl; +// std::cerr << "PluginAdapterBase::Impl::getRemainingFeatures" << std::endl; checkOutputMap(plugin); return convertFeatures(plugin, plugin->getRemainingFeatures()); } VampFeatureList * -PluginAdapterBase::convertFeatures(Plugin *plugin, +PluginAdapterBase::Impl::convertFeatures(Plugin *plugin, const Plugin::FeatureSet &features) { int lastN = -1; @@ -622,10 +720,10 @@ int n = fi->first; -// std::cerr << "PluginAdapterBase::convertFeatures: n = " << n << std::endl; +// std::cerr << "PluginAdapterBase::Impl::convertFeatures: n = " << n << std::endl; if (n >= int(outputCount)) { - std::cerr << "WARNING: PluginAdapterBase::convertFeatures: Too many outputs from plugin (" << n+1 << ", only should be " << outputCount << ")" << std::endl; + std::cerr << "WARNING: PluginAdapterBase::Impl::convertFeatures: Too many outputs from plugin (" << n+1 << ", only should be " << outputCount << ")" << std::endl; continue; } @@ -643,7 +741,7 @@ for (size_t j = 0; j < sz; ++j) { -// std::cerr << "PluginAdapterBase::convertFeatures: j = " << j << std::endl; +// std::cerr << "PluginAdapterBase::Impl::convertFeatures: j = " << j << std::endl; VampFeature *feature = &fs[n].features[j]; @@ -665,7 +763,7 @@ } for (unsigned int k = 0; k < feature->valueCount; ++k) { -// std::cerr << "PluginAdapterBase::convertFeatures: k = " << k << std::endl; +// std::cerr << "PluginAdapterBase::Impl::convertFeatures: k = " << k << std::endl; feature->values[k] = fl[j].values[k]; } } @@ -685,9 +783,9 @@ } void -PluginAdapterBase::resizeFS(Plugin *plugin, int n) +PluginAdapterBase::Impl::resizeFS(Plugin *plugin, int n) { -// std::cerr << "PluginAdapterBase::resizeFS(" << plugin << ", " << n << ")" << std::endl; +// std::cerr << "PluginAdapterBase::Impl::resizeFS(" << plugin << ", " << n << ")" << std::endl; int i = m_fsizes[plugin].size(); if (i >= n) return; @@ -707,9 +805,9 @@ } void -PluginAdapterBase::resizeFL(Plugin *plugin, int n, size_t sz) +PluginAdapterBase::Impl::resizeFL(Plugin *plugin, int n, size_t sz) { -// std::cerr << "PluginAdapterBase::resizeFL(" << plugin << ", " << n << ", " +// std::cerr << "PluginAdapterBase::Impl::resizeFL(" << plugin << ", " << n << ", " // << sz << ")" << std::endl; size_t i = m_fsizes[plugin][n]; @@ -730,9 +828,9 @@ } void -PluginAdapterBase::resizeFV(Plugin *plugin, int n, int j, size_t sz) +PluginAdapterBase::Impl::resizeFV(Plugin *plugin, int n, int j, size_t sz) { -// std::cerr << "PluginAdapterBase::resizeFV(" << plugin << ", " << n << ", " +// std::cerr << "PluginAdapterBase::Impl::resizeFV(" << plugin << ", " << n << ", " // << j << ", " << sz << ")" << std::endl; size_t i = m_fvsizes[plugin][n][j]; @@ -746,8 +844,8 @@ m_fvsizes[plugin][n][j] = sz; } -PluginAdapterBase::AdapterMap * -PluginAdapterBase::m_adapterMap = 0; +PluginAdapterBase::Impl::AdapterMap * +PluginAdapterBase::Impl::m_adapterMap = 0; }
--- a/vamp-sdk/PluginAdapter.h Thu Jun 07 13:56:26 2007 +0000 +++ b/vamp-sdk/PluginAdapter.h Thu Jun 07 14:15:24 2007 +0000 @@ -46,6 +46,8 @@ namespace Vamp { /** + * \class PluginAdapterBase PluginAdapter.h <vamp-sdk/PluginAdapter.h> + * * PluginAdapter and PluginAdapterBase provide a wrapper class that a * plugin library can use to make its C++ Vamp::Plugin objects * available through the Vamp C API. @@ -55,7 +57,7 @@ * plugin class T in their library. It's very simple, and you need to * know absolutely nothing about how it works in order to use it. * Just cut and paste from an existing plugin's discovery function. - * @see vampGetPluginDescriptor + * \see vampGetPluginDescriptor */ class PluginAdapterBase @@ -74,77 +76,13 @@ virtual Plugin *createPlugin(float inputSampleRate) = 0; - static VampPluginHandle vampInstantiate(const VampPluginDescriptor *desc, - float inputSampleRate); - - static void vampCleanup(VampPluginHandle handle); - - static int vampInitialise(VampPluginHandle handle, unsigned int channels, - unsigned int stepSize, unsigned int blockSize); - - static void vampReset(VampPluginHandle handle); - - static float vampGetParameter(VampPluginHandle handle, int param); - static void vampSetParameter(VampPluginHandle handle, int param, float value); - - static unsigned int vampGetCurrentProgram(VampPluginHandle handle); - static void vampSelectProgram(VampPluginHandle handle, unsigned int program); - - static unsigned int vampGetPreferredStepSize(VampPluginHandle handle); - static unsigned int vampGetPreferredBlockSize(VampPluginHandle handle); - static unsigned int vampGetMinChannelCount(VampPluginHandle handle); - static unsigned int vampGetMaxChannelCount(VampPluginHandle handle); - - static unsigned int vampGetOutputCount(VampPluginHandle handle); - - static VampOutputDescriptor *vampGetOutputDescriptor(VampPluginHandle handle, - unsigned int i); - - static void vampReleaseOutputDescriptor(VampOutputDescriptor *desc); - - static VampFeatureList *vampProcess(VampPluginHandle handle, - const float *const *inputBuffers, - int sec, - int nsec); - - static VampFeatureList *vampGetRemainingFeatures(VampPluginHandle handle); - - static void vampReleaseFeatureSet(VampFeatureList *fs); - - void cleanup(Plugin *plugin); - void checkOutputMap(Plugin *plugin); - unsigned int getOutputCount(Plugin *plugin); - VampOutputDescriptor *getOutputDescriptor(Plugin *plugin, - unsigned int i); - VampFeatureList *process(Plugin *plugin, - const float *const *inputBuffers, - int sec, int nsec); - VampFeatureList *getRemainingFeatures(Plugin *plugin); - VampFeatureList *convertFeatures(Plugin *plugin, - const Plugin::FeatureSet &features); - - // maps both plugins and descriptors to adapters - typedef std::map<const void *, PluginAdapterBase *> AdapterMap; - static AdapterMap *m_adapterMap; - static PluginAdapterBase *lookupAdapter(VampPluginHandle); - - bool m_populated; - VampPluginDescriptor m_descriptor; - Plugin::ParameterList m_parameters; - Plugin::ProgramList m_programs; - - typedef std::map<Plugin *, Plugin::OutputList *> OutputMap; - OutputMap m_pluginOutputs; - - std::map<Plugin *, VampFeatureList *> m_fs; - std::map<Plugin *, std::vector<size_t> > m_fsizes; - std::map<Plugin *, std::vector<std::vector<size_t> > > m_fvsizes; - void resizeFS(Plugin *plugin, int n); - void resizeFL(Plugin *plugin, int n, size_t sz); - void resizeFV(Plugin *plugin, int n, int j, size_t sz); + class Impl; + Impl *m_impl; }; /** + * \class PluginAdapter PluginAdapter.h <vamp-sdk/PluginAdapter.h> + * * PluginAdapter turns a PluginAdapterBase into a specific wrapper for * a particular plugin implementation. *
--- a/vamp-sdk/PluginHostAdapter.h Thu Jun 07 13:56:26 2007 +0000 +++ b/vamp-sdk/PluginHostAdapter.h Thu Jun 07 14:15:24 2007 +0000 @@ -45,6 +45,8 @@ namespace Vamp { /** + * \class PluginHostAdapter PluginHostAdapter.h <vamp-sdk/PluginHostAdapter.h> + * * PluginHostAdapter is a wrapper class that a Vamp host can use to * make the C-language VampPluginDescriptor object appear as a C++ * Vamp::Plugin object.
--- a/vamp-sdk/RealTime.h Thu Jun 07 13:56:26 2007 +0000 +++ b/vamp-sdk/RealTime.h Thu Jun 07 14:15:24 2007 +0000 @@ -52,6 +52,8 @@ namespace Vamp { /** + * \class RealTime RealTime.h <vamp-sdk/RealTime.h> + * * RealTime represents time values to nanosecond precision * with accurate arithmetic and frame-rate conversion functions. */
--- a/vamp-sdk/hostext/PluginChannelAdapter.h Thu Jun 07 13:56:26 2007 +0000 +++ b/vamp-sdk/hostext/PluginChannelAdapter.h Thu Jun 07 14:15:24 2007 +0000 @@ -44,6 +44,8 @@ namespace HostExt { /** + * \class PluginChannelAdapter PluginChannelAdapter.h <vamp-sdk/hostext/PluginChannelAdapter.h> + * * PluginChannelAdapter is a Vamp plugin adapter that implements a * policy for management of plugins that expect a different number of * input channels from the number actually available in the source @@ -101,7 +103,7 @@ * wraps. The wrapped plugin will be deleted when the wrapper is * deleted. * - * \note This class was introduced version 1.1 of the Vamp plugin SDK. + * \note This class was introduced in version 1.1 of the Vamp plugin SDK. */ class PluginChannelAdapter : public PluginWrapper
--- a/vamp-sdk/hostext/PluginInputDomainAdapter.h Thu Jun 07 13:56:26 2007 +0000 +++ b/vamp-sdk/hostext/PluginInputDomainAdapter.h Thu Jun 07 14:15:24 2007 +0000 @@ -44,6 +44,8 @@ namespace HostExt { /** + * \class PluginInputDomainAdapter PluginInputDomainAdapter.h <vamp-sdk/hostext/PluginInputDomainAdapter.h> + * * PluginInputDomainAdapter is a Vamp plugin adapter that converts * time-domain input into frequency-domain input for plugins that need * it. This permits a host to use time- and frequency-domain plugins @@ -71,7 +73,7 @@ * wraps. The wrapped plugin will be deleted when the wrapper is * deleted. * - * \note This class was introduced version 1.1 of the Vamp plugin SDK. + * \note This class was introduced in version 1.1 of the Vamp plugin SDK. */ class PluginInputDomainAdapter : public PluginWrapper
--- a/vamp-sdk/hostext/PluginLoader.h Thu Jun 07 13:56:26 2007 +0000 +++ b/vamp-sdk/hostext/PluginLoader.h Thu Jun 07 14:15:24 2007 +0000 @@ -50,6 +50,8 @@ namespace HostExt { /** + * \class PluginLoader PluginLoader.h <vamp-sdk/hostext/PluginLoader.h> + * * Vamp::HostExt::PluginLoader is a convenience class for discovering * and loading Vamp plugins using the typical plugin-path, library * naming, and categorisation conventions described in the Vamp SDK @@ -61,7 +63,7 @@ * class, and are certainly not required to use this actual class. * But we do strongly recommend it. * - * \note This class was introduced version 1.1 of the Vamp plugin SDK. + * \note This class was introduced in version 1.1 of the Vamp plugin SDK. */ class PluginLoader
--- a/vamp-sdk/hostext/PluginWrapper.h Thu Jun 07 13:56:26 2007 +0000 +++ b/vamp-sdk/hostext/PluginWrapper.h Thu Jun 07 14:15:24 2007 +0000 @@ -44,6 +44,8 @@ namespace HostExt { /** + * \class PluginWrapper PluginWrapper.h <vamp-sdk/hostext/PluginWrapper.h> + * * PluginWrapper is a simple base class for adapter plugins. It takes * a pointer to a "to be wrapped" Vamp plugin on construction, and * provides implementations of all the Vamp plugin methods that simply @@ -51,7 +53,7 @@ * override only the methods that are meaningful for the particular * adapter. * - * \note This class was introduced version 1.1 of the Vamp plugin SDK. + * \note This class was introduced in version 1.1 of the Vamp plugin SDK. */ class PluginWrapper : public Plugin