Mercurial > hg > azi
changeset 0:d960c4931501
Import Vamp plugin skeleton
author | Chris Cannam |
---|---|
date | Fri, 25 Jul 2014 17:11:57 +0100 |
parents | |
children | 41b09144491b |
files | Azi.cpp Azi.h Makefile.inc Makefile.linux plugins.cpp vamp-plugin.list vamp-plugin.map |
diffstat | 7 files changed, 351 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Azi.cpp Fri Jul 25 17:11:57 2014 +0100 @@ -0,0 +1,215 @@ + +#include "Azi.h" + + +Azi::Azi(float inputSampleRate) : + Plugin(inputSampleRate) + // Also be sure to set your plugin parameters (presumably stored + // in member variables) to their default values here -- the host + // will not do that for you +{ +} + +Azi::~Azi() +{ +} + +string +Azi::getIdentifier() const +{ + return "azi"; +} + +string +Azi::getName() const +{ + return "Stereo Plan"; +} + +string +Azi::getDescription() const +{ + // Return something helpful here! + return ""; +} + +string +Azi::getMaker() const +{ + // Your name here + return ""; +} + +int +Azi::getPluginVersion() const +{ + // Increment this each time you release a version that behaves + // differently from the previous one + return 1; +} + +string +Azi::getCopyright() const +{ + // This function is not ideally named. It does not necessarily + // need to say who made the plugin -- getMaker does that -- but it + // should indicate the terms under which it is distributed. For + // example, "Copyright (year). All Rights Reserved", or "GPL" + return ""; +} + +Azi::InputDomain +Azi::getInputDomain() const +{ + return TimeDomain; +} + +size_t +Azi::getPreferredBlockSize() const +{ + return 0; // 0 means "I can handle any block size" +} + +size_t +Azi::getPreferredStepSize() const +{ + return 0; // 0 means "anything sensible"; in practice this + // means the same as the block size for TimeDomain + // plugins, or half of it for FrequencyDomain plugins +} + +size_t +Azi::getMinChannelCount() const +{ + return 1; +} + +size_t +Azi::getMaxChannelCount() const +{ + return 1; +} + +Azi::ParameterList +Azi::getParameterDescriptors() const +{ + ParameterList list; + + // If the plugin has no adjustable parameters, return an empty + // list here (and there's no need to provide implementations of + // getParameter and setParameter in that case either). + + // Note that it is your responsibility to make sure the parameters + // start off having their default values (e.g. in the constructor + // above). The host needs to know the default value so it can do + // things like provide a "reset to default" function, but it will + // not explicitly set your parameters to their defaults for you if + // they have not changed in the mean time. + + ParameterDescriptor d; + d.identifier = "parameter"; + d.name = "Some Parameter"; + d.description = ""; + d.unit = ""; + d.minValue = 0; + d.maxValue = 10; + d.defaultValue = 5; + d.isQuantized = false; + list.push_back(d); + + return list; +} + +float +Azi::getParameter(string identifier) const +{ + if (identifier == "parameter") { + return 5; // return the ACTUAL current value of your parameter here! + } + return 0; +} + +void +Azi::setParameter(string identifier, float value) +{ + if (identifier == "parameter") { + // set the actual value of your parameter + } +} + +Azi::ProgramList +Azi::getPrograms() const +{ + ProgramList list; + + // If you have no programs, return an empty list (or simply don't + // implement this function or getCurrentProgram/selectProgram) + + return list; +} + +string +Azi::getCurrentProgram() const +{ + return ""; // no programs +} + +void +Azi::selectProgram(string name) +{ +} + +Azi::OutputList +Azi::getOutputDescriptors() const +{ + OutputList list; + + // See OutputDescriptor documentation for the possibilities here. + // Every plugin must have at least one output. + + OutputDescriptor d; + d.identifier = "output"; + d.name = "My Output"; + d.description = ""; + d.unit = ""; + d.hasFixedBinCount = true; + d.binCount = 1; + d.hasKnownExtents = false; + d.isQuantized = false; + d.sampleType = OutputDescriptor::OneSamplePerStep; + d.hasDuration = false; + list.push_back(d); + + return list; +} + +bool +Azi::initialise(size_t channels, size_t stepSize, size_t blockSize) +{ + if (channels < getMinChannelCount() || + channels > getMaxChannelCount()) return false; + + // Real initialisation work goes here! + + return true; +} + +void +Azi::reset() +{ + // Clear buffers, reset stored values, etc +} + +Azi::FeatureSet +Azi::process(const float *const *inputBuffers, Vamp::RealTime timestamp) +{ + // Do actual work! + return FeatureSet(); +} + +Azi::FeatureSet +Azi::getRemainingFeatures() +{ + return FeatureSet(); +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Azi.h Fri Jul 25 17:11:57 2014 +0100 @@ -0,0 +1,52 @@ +#ifndef AZI_H +#define AZI_H + +#include <vamp-sdk/Plugin.h> + +using std::string; + + +class Azi : public Vamp::Plugin +{ +public: + Azi(float inputSampleRate); + virtual ~Azi(); + + string getIdentifier() const; + string getName() const; + string getDescription() const; + string getMaker() const; + int getPluginVersion() const; + string getCopyright() const; + + InputDomain getInputDomain() const; + size_t getPreferredBlockSize() const; + size_t getPreferredStepSize() const; + size_t getMinChannelCount() const; + size_t getMaxChannelCount() const; + + ParameterList getParameterDescriptors() const; + float getParameter(string identifier) const; + void setParameter(string identifier, float value); + + ProgramList getPrograms() const; + string getCurrentProgram() const; + void selectProgram(string name); + + OutputList getOutputDescriptors() const; + + bool initialise(size_t channels, size_t stepSize, size_t blockSize); + void reset(); + + FeatureSet process(const float *const *inputBuffers, + Vamp::RealTime timestamp); + + FeatureSet getRemainingFeatures(); + +protected: + // plugin-specific data and methods go here +}; + + + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Makefile.inc Fri Jul 25 17:11:57 2014 +0100 @@ -0,0 +1,44 @@ + +SRC_DIR := . + +VAMPSDK_DIR ?= ../vamp-plugin-sdk + +PLUGIN_EXT ?= .so + +CXX ?= g++ +CC ?= gcc + +CFLAGS := $(CFLAGS) +CXXFLAGS := $(CFLAGS) -I. -I$(VAMPSDK_DIR) $(CXXFLAGS) + +LDFLAGS := $(LDFLAGS) +PLUGIN_LDFLAGS := $(LDFLAGS) $(PLUGIN_LDFLAGS) + +PLUGIN := azi$(PLUGIN_EXT) + +PLUGIN_HEADERS := $(SRC_DIR)/Azi.h +PLUGIN_SOURCES := $(SRC_DIR)/Azi.cpp + +HEADERS := $(PLUGIN_HEADERS) +SOURCES := $(PLUGIN_SOURCES) +OBJECTS := $(SOURCES:.cpp=.o) +OBJECTS := $(OBJECTS:.c=.o) + +LIBS := $(VAMPSDK_DIR)/libvamp-sdk.a + +all: $(PLUGIN) + +$(PLUGIN): $(OBJECTS) $(LIBS) + $(CXX) -o $@ $^ $(LIBS) $(PLUGIN_LDFLAGS) + +clean: + rm -f $(OBJECTS) + +distclean: clean + rm -f $(PLUGIN) + +depend: + makedepend -Y -fMakefile.inc $(SOURCES) $(HEADERS) + +# DO NOT DELETE +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Makefile.linux Fri Jul 25 17:11:57 2014 +0100 @@ -0,0 +1,15 @@ + +CFLAGS := -Wall -O3 -fopenmp -ffast-math -msse -msse2 -mfpmath=sse -ftree-vectorize -fPIC -I../vamp-plugin-sdk/ -DUSE_PTHREADS + +#CFLAGS := -g -fPIC -I../vamp-plugin-sdk + +CXXFLAGS := $(CFLAGS) + +VAMPSDK_DIR := ../vamp-plugin-sdk +PLUGIN_LDFLAGS := -lgomp -shared -Wl,-Bsymbolic -Wl,-z,defs -Wl,--version-script=vamp-plugin.map -lpthread + +PLUGIN_EXT := .so + +include Makefile.inc + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins.cpp Fri Jul 25 17:11:57 2014 +0100 @@ -0,0 +1,20 @@ + +#include <vamp/vamp.h> +#include <vamp-sdk/PluginAdapter.h> + +#include "Azi.h" + +static Vamp::PluginAdapter<Azi> myPluginAdapter; + +const VampPluginDescriptor * +vampGetPluginDescriptor(unsigned int version, unsigned int index) +{ + if (version < 1) return 0; + + switch (index) { + case 0: return myPluginAdapter.getDescriptor(); + default: return 0; + } +} + +