PluginWrapper.h
Go to the documentation of this file.
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
/*
Vamp
An API for audio analysis and feature extraction plugins.
Centre for Digital Music, Queen Mary, University of London.
Copyright 2006-2009 Chris Cannam and QMUL.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use, copy,
modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the names of the Centre for
Digital Music; Queen Mary, University of London; and Chris Cannam
shall not be used in advertising or otherwise to promote the sale,
use or other dealings in this Software without prior written
authorization.
*/
#ifndef _VAMP_PLUGIN_WRAPPER_H_
#define _VAMP_PLUGIN_WRAPPER_H_
#include "hostguard.h"
#include <vamp-hostsdk/Plugin.h>
_VAMP_SDK_HOSTSPACE_BEGIN(PluginWrapper.h)
namespace Vamp {
namespace HostExt {
class PluginWrapper : public Plugin
{
public:
virtual ~PluginWrapper();
bool initialise(size_t channels, size_t stepSize, size_t blockSize);
void reset();
InputDomain getInputDomain() const;
unsigned int getVampApiVersion() const;
std::string getIdentifier() const;
std::string getName() const;
std::string getDescription() const;
std::string getMaker() const;
int getPluginVersion() const;
std::string getCopyright() const;
ParameterList getParameterDescriptors() const;
float getParameter(std::string) const;
void setParameter(std::string, float);
ProgramList getPrograms() const;
std::string getCurrentProgram() const;
void selectProgram(std::string);
size_t getPreferredStepSize() const;
size_t getPreferredBlockSize() const;
size_t getMinChannelCount() const;
size_t getMaxChannelCount() const;
OutputList getOutputDescriptors() const;
FeatureSet process(const float *const *inputBuffers, RealTime timestamp);
FeatureSet getRemainingFeatures();
template <typename WrapperType>
WrapperType *getWrapper() {
WrapperType *w = dynamic_cast<WrapperType *>(this);
if (w) return w;
PluginWrapper *pw = dynamic_cast<PluginWrapper *>(m_plugin);
if (pw) return pw->getWrapper<WrapperType>();
return 0;
}
void disownPlugin();
protected:
PluginWrapper(Plugin *plugin); // I take ownership of plugin
Plugin *m_plugin;
bool m_pluginIsOwned;
};
}
}
_VAMP_SDK_HOSTSPACE_END(PluginWrapper.h)
#endif
Vamp::HostExt::PluginWrapper
PluginWrapper is a simple base class for adapter plugins.
Definition PluginWrapper.h:66
Vamp::HostExt::PluginWrapper::selectProgram
void selectProgram(std::string)
Select a program.
Vamp::HostExt::PluginWrapper::m_pluginIsOwned
bool m_pluginIsOwned
Definition PluginWrapper.h:145
Vamp::HostExt::PluginWrapper::getRemainingFeatures
FeatureSet getRemainingFeatures()
After all blocks have been processed, calculate and return any remaining features derived from the co...
Vamp::HostExt::PluginWrapper::PluginWrapper
PluginWrapper(Plugin *plugin)
Vamp::HostExt::PluginWrapper::getCurrentProgram
std::string getCurrentProgram() const
Get the current program.
Vamp::HostExt::PluginWrapper::getParameter
float getParameter(std::string) const
Get the value of a named parameter.
Vamp::HostExt::PluginWrapper::setParameter
void setParameter(std::string, float)
Set a named parameter.
Vamp::HostExt::PluginWrapper::process
FeatureSet process(const float *const *inputBuffers, RealTime timestamp)
Process a single block of input data.
Vamp::HostExt::PluginWrapper::disownPlugin
void disownPlugin()
Disown the wrapped plugin, so that we no longer delete it on our own destruction.
Vamp::HostExt::PluginWrapper::getWrapper
WrapperType * getWrapper()
Return a pointer to the plugin wrapper of type WrapperType surrounding this wrapper's plugin,...
Definition PluginWrapper.h:119
Vamp::HostExt::PluginWrapper::getInputDomain
InputDomain getInputDomain() const
Get the plugin's required input domain.
Vamp::HostExt::PluginWrapper::getPreferredBlockSize
size_t getPreferredBlockSize() const
Get the preferred block size (window size – the number of sample frames passed in each block to the p...
Vamp::HostExt::PluginWrapper::getPluginVersion
int getPluginVersion() const
Get the version number of the plugin.
Vamp::HostExt::PluginWrapper::getPrograms
ProgramList getPrograms() const
Get the program settings available in this plugin.
Vamp::HostExt::PluginWrapper::getName
std::string getName() const
Get a human-readable name or title of the plugin.
Vamp::HostExt::PluginWrapper::initialise
bool initialise(size_t channels, size_t stepSize, size_t blockSize)
Initialise a plugin to prepare it for use with the given number of input channels,...
Vamp::HostExt::PluginWrapper::getParameterDescriptors
ParameterList getParameterDescriptors() const
Get the controllable parameters of this plugin.
Vamp::HostExt::PluginWrapper::m_plugin
Plugin * m_plugin
Definition PluginWrapper.h:144
Vamp::HostExt::PluginWrapper::getMinChannelCount
size_t getMinChannelCount() const
Get the minimum supported number of input channels.
Vamp::HostExt::PluginWrapper::~PluginWrapper
virtual ~PluginWrapper()
Vamp::HostExt::PluginWrapper::getMaxChannelCount
size_t getMaxChannelCount() const
Get the maximum supported number of input channels.
Vamp::HostExt::PluginWrapper::reset
void reset()
Reset the plugin after use, to prepare it for another clean run.
Vamp::HostExt::PluginWrapper::getDescription
std::string getDescription() const
Get a human-readable description for the plugin, typically a line of text that may optionally be disp...
Vamp::HostExt::PluginWrapper::getIdentifier
std::string getIdentifier() const
Get the computer-usable name of the plugin.
Vamp::HostExt::PluginWrapper::getPreferredStepSize
size_t getPreferredStepSize() const
Get the preferred step size (window increment – the distance in sample frames between the start frame...
Vamp::HostExt::PluginWrapper::getCopyright
std::string getCopyright() const
Get the copyright statement or licensing summary for the plugin.
Vamp::HostExt::PluginWrapper::getOutputDescriptors
OutputList getOutputDescriptors() const
Get the outputs of this plugin.
Vamp::HostExt::PluginWrapper::getMaker
std::string getMaker() const
Get the name of the author or vendor of the plugin in human-readable form.
Vamp::HostExt::PluginWrapper::getVampApiVersion
unsigned int getVampApiVersion() const
Get the Vamp API compatibility level of the plugin.
Vamp::PluginBase::ParameterList
std::vector< ParameterDescriptor > ParameterList
Definition vamp-sdk/PluginBase.h:203
Vamp::PluginBase::ProgramList
std::vector< std::string > ProgramList
Definition vamp-sdk/PluginBase.h:225
Vamp::Plugin
Vamp::Plugin is a base class for plugin instance classes that provide feature extraction from audio o...
Definition vamp-sdk/Plugin.h:125
Vamp::Plugin::OutputList
std::vector< OutputDescriptor > OutputList
Definition vamp-sdk/Plugin.h:335
Vamp::Plugin::InputDomain
InputDomain
Definition vamp-sdk/Plugin.h:152
Vamp::Plugin::FeatureSet
std::map< int, FeatureList > FeatureSet
Definition vamp-sdk/Plugin.h:395
hostguard.h
_VAMP_SDK_HOSTSPACE_END
#define _VAMP_SDK_HOSTSPACE_END(h)
Definition hostguard.h:59
_VAMP_SDK_HOSTSPACE_BEGIN
#define _VAMP_SDK_HOSTSPACE_BEGIN(h)
Definition hostguard.h:56
Vamp
Definition FFT.h:43
Vamp::RealTime
RealTime represents time values to nanosecond precision with accurate arithmetic and frame-rate conve...
Definition vamp-sdk/RealTime.h:67
Plugin.h