vamp-sdk/PluginBase.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 Chris Cannam.
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_SDK_PLUGIN_BASE_H_
#define _VAMP_SDK_PLUGIN_BASE_H_
#include <string>
#include <vector>
#include "plugguard.h"
_VAMP_SDK_PLUGSPACE_BEGIN(PluginBase.h)
namespace Vamp {
class PluginBase
{
public:
virtual ~PluginBase() { }
virtual unsigned int getVampApiVersion() const { return 2; }
virtual std::string getIdentifier() const = 0;
virtual std::string getName() const = 0;
virtual std::string getDescription() const = 0;
virtual std::string getMaker() const = 0;
virtual std::string getCopyright() const = 0;
virtual int getPluginVersion() const = 0;
struct ParameterDescriptor
{
std::string identifier;
std::string name;
std::string description;
std::string unit;
float minValue;
float maxValue;
float defaultValue;
bool isQuantized;
float quantizeStep;
std::vector<std::string> valueNames;
ParameterDescriptor() : // the defaults are invalid: you must set them
minValue(0),
maxValue(0),
defaultValue(0),
isQuantized(false),
quantizeStep(0) { }
};
typedef std::vector<ParameterDescriptor> ParameterList;
virtual ParameterList getParameterDescriptors() const {
return ParameterList();
}
virtual float getParameter(std::string) const { return 0.0; }
virtual void setParameter(std::string, float) { }
typedef std::vector<std::string> ProgramList;
virtual ProgramList getPrograms() const { return ProgramList(); }
virtual std::string getCurrentProgram() const { return ""; }
virtual void selectProgram(std::string) { }
virtual std::string getType() const = 0;
};
}
_VAMP_SDK_PLUGSPACE_END(PluginBase.h)
#endif
Vamp::PluginBase::setParameter
virtual void setParameter(std::string, float)
Set a named parameter.
Definition: vamp-sdk/PluginBase.h:222
Vamp::PluginBase::getParameter
virtual float getParameter(std::string) const
Get the value of a named parameter.
Definition: vamp-sdk/PluginBase.h:216
Vamp
Definition: FFT.h:43
Vamp::PluginBase::selectProgram
virtual void selectProgram(std::string)
Select a program.
Definition: vamp-sdk/PluginBase.h:248
Vamp::PluginBase::ParameterDescriptor::identifier
std::string identifier
The name of the parameter, in computer-usable form.
Definition: vamp-sdk/PluginBase.h:133
Vamp::PluginBase::ParameterDescriptor::ParameterDescriptor
ParameterDescriptor()
Definition: vamp-sdk/PluginBase.h:195
Vamp::PluginBase::ParameterDescriptor::valueNames
std::vector< std::string > valueNames
Names for the quantized values.
Definition: vamp-sdk/PluginBase.h:193
Vamp::PluginBase::getVampApiVersion
virtual unsigned int getVampApiVersion() const
Get the Vamp API compatibility level of the plugin.
Definition: vamp-sdk/PluginBase.h:68
Vamp::PluginBase::ParameterDescriptor::name
std::string name
The human-readable name of the parameter.
Definition: vamp-sdk/PluginBase.h:138
Vamp::PluginBase::getCurrentProgram
virtual std::string getCurrentProgram() const
Get the current program.
Definition: vamp-sdk/PluginBase.h:242
Vamp::PluginBase::ParameterDescriptor::minValue
float minValue
The minimum value of the parameter.
Definition: vamp-sdk/PluginBase.h:154
Vamp::PluginBase::getPrograms
virtual ProgramList getPrograms() const
Get the program settings available in this plugin.
Definition: vamp-sdk/PluginBase.h:237
Vamp::PluginBase::ParameterDescriptor::unit
std::string unit
The unit of the parameter, in human-readable form.
Definition: vamp-sdk/PluginBase.h:149
_VAMP_SDK_PLUGSPACE_BEGIN
#define _VAMP_SDK_PLUGSPACE_BEGIN(h)
Definition: plugguard.h:79
Vamp::PluginBase::ParameterDescriptor::description
std::string description
A human-readable short text describing the parameter.
Definition: vamp-sdk/PluginBase.h:144
Vamp::PluginBase::ParameterDescriptor
Definition: vamp-sdk/PluginBase.h:126
Vamp::PluginBase::ParameterDescriptor::maxValue
float maxValue
The maximum value of the parameter.
Definition: vamp-sdk/PluginBase.h:159
Vamp::PluginBase::ProgramList
std::vector< std::string > ProgramList
Definition: vamp-sdk/PluginBase.h:225
_VAMP_SDK_PLUGSPACE_END
#define _VAMP_SDK_PLUGSPACE_END(h)
Definition: plugguard.h:80
Vamp::PluginBase::~PluginBase
virtual ~PluginBase()
Definition: vamp-sdk/PluginBase.h:63
Vamp::PluginBase::getParameterDescriptors
virtual ParameterList getParameterDescriptors() const
Get the controllable parameters of this plugin.
Definition: vamp-sdk/PluginBase.h:208
Vamp::PluginBase
A base class for plugins with optional configurable parameters, programs, etc.
Definition: vamp-sdk/PluginBase.h:60
Vamp::PluginBase::ParameterDescriptor::defaultValue
float defaultValue
The default value of the parameter.
Definition: vamp-sdk/PluginBase.h:167
Vamp::PluginBase::ParameterDescriptor::quantizeStep
float quantizeStep
Quantization resolution of the parameter values (e.g.
Definition: vamp-sdk/PluginBase.h:180
Vamp::PluginBase::ParameterDescriptor::isQuantized
bool isQuantized
True if the parameter values are quantized to a particular resolution.
Definition: vamp-sdk/PluginBase.h:173
plugguard.h
Vamp::PluginBase::ParameterList
std::vector< ParameterDescriptor > ParameterList
Definition: vamp-sdk/PluginBase.h:203