changeset 0:8a8d8c1f3968

Skeleton
author Chris Cannam
date Fri, 23 Jan 2015 17:41:22 +0000
parents
children 141bda033074
files Makefile.inc Makefile.linux Makefile.mingw32 Makefile.osx TuningDifference.cpp TuningDifference.h plugins.cpp vamp-plugin.list vamp-plugin.map
diffstat 9 files changed, 486 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile.inc	Fri Jan 23 17:41:22 2015 +0000
@@ -0,0 +1,73 @@
+
+##  Makefile for Vamp plugin builds using command-line tools.
+##
+##  This file defines all of the system-independent information about
+##  your project: the list of source files, plugin library name, etc.
+##  Edit this file to make sure it has all the right information.
+##
+##  This file does not define the system-specific stuff such as which
+##  compiler to use -- that goes into Makefile.osx, Makefile.mingw32,
+##  Makefile.linux etc.  Those files all include this file, so that
+##  they all have a consistent set of project data.
+##
+##  To build the plugin project, type
+##
+##    $ gmake -f Makefile.osx
+##
+##  or whatever the equivalent filename suffix is for your platform.
+##
+##  This requires GNU make, which is what you get with OS/X, Linux, or
+##  MinGW/Cygwin on Windows.
+##
+##  (For Windows builds using MS Visual Studio, start instead with the
+##  VampExamplePlugins project found in the build directory of the SDK.)
+
+
+# Edit this to the base name of your plugin library
+#
+PLUGIN_LIBRARY_NAME := tuning-difference
+
+# Edit this to list the .cpp or .c files in your plugin project
+#
+PLUGIN_SOURCES := TuningDifference.cpp plugins.cpp
+
+# Edit this to list the .h files in your plugin project
+#
+PLUGIN_HEADERS := TuningDifference.h
+
+
+##  Normally you should not edit anything below this line
+
+SRC_DIR		:= .
+
+CFLAGS		:= $(ARCHFLAGS) $(CFLAGS)
+CXXFLAGS	:= $(CFLAGS) -I. -I$(VAMPSDK_DIR) $(CXXFLAGS)
+
+LDFLAGS		:= $(ARCHFLAGS) $(LDFLAGS) 
+PLUGIN_LDFLAGS	:= $(LDFLAGS) $(PLUGIN_LDFLAGS)
+
+# Defaults, overridden from the platform-specific Makefile
+VAMPSDK_DIR	?= ../vamp-plugin-sdk
+PLUGIN_EXT	?= .so
+CXX 		?= g++
+CC 		?= gcc
+
+PLUGIN 		:= $(PLUGIN_LIBRARY_NAME)$(PLUGIN_EXT)
+
+PLUGIN_OBJECTS 	:= $(PLUGIN_SOURCES:.cpp=.o)
+PLUGIN_OBJECTS 	:= $(PLUGIN_OBJECTS:.c=.o)
+
+$(PLUGIN): $(PLUGIN_OBJECTS) 
+	   $(CXX) -o $@ $^ $(PLUGIN_LDFLAGS)
+
+$(PLUGIN_OBJECTS): $(PLUGIN_HEADERS)
+
+clean:
+	rm -f $(PLUGIN_OBJECTS)
+
+distclean:	clean
+	rm -f $(PLUGIN)
+
+depend:
+	makedepend -Y -fMakefile.inc $(PLUGIN_SOURCES) $(PLUGIN_HEADERS)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile.linux	Fri Jan 23 17:41:22 2015 +0000
@@ -0,0 +1,38 @@
+
+##  Makefile for Vamp plugin using GNU tools on Linux.
+##
+##  Edit this to adjust compiler and library settings when
+##  building for Linux.
+##
+##  Note that the list of source files, etc, goes in Makefile.inc
+##  instead so that it can be included by all platform Makefiles.
+
+
+# For a debug build...
+
+CFLAGS		:= -Wall -Wextra -g -fPIC
+
+# ... or for a release build
+
+#CFLAGS		:= -Wall -Wextra -O3 -msse -msse2 -mfpmath=sse -ftree-vectorize -fPIC
+
+
+# Location of Vamp plugin SDK relative to the project directory
+
+VAMPSDK_DIR	:= ../vamp-plugin-sdk
+
+
+# Libraries and linker flags required by plugin: add any -l<library>
+# options here
+
+PLUGIN_LDFLAGS	:= -shared -Wl,-Bsymbolic -Wl,-z,defs -Wl,--version-script=vamp-plugin.map $(VAMPSDK_DIR)/libvamp-sdk.a
+
+
+# File extension for plugin library on this platform
+
+PLUGIN_EXT	:= .so
+
+
+include Makefile.inc
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile.mingw32	Fri Jan 23 17:41:22 2015 +0000
@@ -0,0 +1,43 @@
+
+##  Makefile for Vamp plugin using MinGW tools on Windows.
+##
+##  Edit this to adjust compiler and library settings when
+##  building using MinGW.
+##
+##  Note that the list of source files, etc, goes in Makefile.inc
+##  instead so that it can be included by all platform Makefiles.
+
+TOOLPREFIX     ?= 
+CXX		= $(TOOLPREFIX)g++
+CC		= $(TOOLPREFIX)gcc
+LD		= $(TOOLPREFIX)g++
+AR		= $(TOOLPREFIX)ar
+RANLIB		= $(TOOLPREFIX)ranlib
+
+
+# For a debug build...
+
+CFLAGS		:= -Wall -Wextra -g
+
+# ... or for a release build
+
+#CFLAGS		:= -Wall -Wextra -O3 -ftree-vectorize
+
+
+# Location of Vamp plugin SDK relative to the project directory
+
+VAMPSDK_DIR	:= ../vamp-plugin-sdk
+
+
+# Libraries and linker flags required by plugin: add any -l<library>
+# options here
+
+PLUGIN_LDFLAGS	:= -shared -static -Wl,--retain-symbols-file=vamp-plugin.list $(VAMPSDK_DIR)/libvamp-sdk.a
+
+
+# File extension for plugin library on this platform
+
+PLUGIN_EXT	:= .dll
+
+
+include Makefile.inc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile.osx	Fri Jan 23 17:41:22 2015 +0000
@@ -0,0 +1,43 @@
+
+##  Makefile for Vamp plugin using command-line tools on OS/X.
+##
+##  Edit this to adjust compiler and library settings when
+##  building for OS/X.
+##
+##  Note that the list of source files, etc, goes in Makefile.inc
+##  instead so that it can be included by all platform Makefiles.
+
+
+# For a debug build...
+
+CFLAGS		:= -Wall -Wextra -g -fPIC
+
+# ... or for a release build
+
+#CFLAGS		:= -Wall -Wextra -O3 -ftree-vectorize -fPIC
+
+
+# Flags to determine processor architecture and system SDK
+
+ARCHFLAGS	?= -mmacosx-version-min=10.6 -arch x86_64 -arch i386
+
+
+# Location of Vamp plugin SDK relative to the project directory
+
+VAMPSDK_DIR	:= ../vamp-plugin-sdk
+
+
+# Libraries and linker flags required by plugin: add any -l<library>
+# options here
+
+PLUGIN_LDFLAGS	:= -dynamiclib -exported_symbols_list vamp-plugin.list $(VAMPSDK_DIR)/libvamp-sdk.a
+
+
+# File extension for plugin library on this platform
+
+PLUGIN_EXT	:= .dylib
+
+
+include Makefile.inc
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TuningDifference.cpp	Fri Jan 23 17:41:22 2015 +0000
@@ -0,0 +1,212 @@
+
+#include "TuningDifference.h"
+
+
+TuningDifference::TuningDifference(float inputSampleRate) :
+    Plugin(inputSampleRate)
+{
+}
+
+TuningDifference::~TuningDifference()
+{
+}
+
+string
+TuningDifference::getIdentifier() const
+{
+    return "myplugin";
+}
+
+string
+TuningDifference::getName() const
+{
+    return "My Plugin";
+}
+
+string
+TuningDifference::getDescription() const
+{
+    // Return something helpful here!
+    return "";
+}
+
+string
+TuningDifference::getMaker() const
+{
+    // Your name here
+    return "";
+}
+
+int
+TuningDifference::getPluginVersion() const
+{
+    // Increment this each time you release a version that behaves
+    // differently from the previous one
+    return 1;
+}
+
+string
+TuningDifference::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 "";
+}
+
+TuningDifference::InputDomain
+TuningDifference::getInputDomain() const
+{
+    return TimeDomain;
+}
+
+size_t
+TuningDifference::getPreferredBlockSize() const
+{
+    return 0; // 0 means "I can handle any block size"
+}
+
+size_t 
+TuningDifference::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
+TuningDifference::getMinChannelCount() const
+{
+    return 1;
+}
+
+size_t
+TuningDifference::getMaxChannelCount() const
+{
+    return 1;
+}
+
+TuningDifference::ParameterList
+TuningDifference::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
+TuningDifference::getParameter(string identifier) const
+{
+    if (identifier == "parameter") {
+        return 5; // return the ACTUAL current value of your parameter here!
+    }
+    return 0;
+}
+
+void
+TuningDifference::setParameter(string identifier, float value) 
+{
+    if (identifier == "parameter") {
+        // set the actual value of your parameter
+    }
+}
+
+TuningDifference::ProgramList
+TuningDifference::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
+TuningDifference::getCurrentProgram() const
+{
+    return ""; // no programs
+}
+
+void
+TuningDifference::selectProgram(string name)
+{
+}
+
+TuningDifference::OutputList
+TuningDifference::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
+TuningDifference::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
+TuningDifference::reset()
+{
+    // Clear buffers, reset stored values, etc
+}
+
+TuningDifference::FeatureSet
+TuningDifference::process(const float *const *inputBuffers, Vamp::RealTime timestamp)
+{
+    // Do actual work!
+    return FeatureSet();
+}
+
+TuningDifference::FeatureSet
+TuningDifference::getRemainingFeatures()
+{
+    return FeatureSet();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TuningDifference.h	Fri Jan 23 17:41:22 2015 +0000
@@ -0,0 +1,51 @@
+#ifndef TUNING_DIFFERENCE_H
+#define TUNING_DIFFERENCE_H
+
+#include <vamp-sdk/Plugin.h>
+
+using std::string;
+
+
+class TuningDifference : public Vamp::Plugin
+{
+public:
+    TuningDifference(float inputSampleRate);
+    virtual ~TuningDifference();
+
+    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/plugins.cpp	Fri Jan 23 17:41:22 2015 +0000
@@ -0,0 +1,21 @@
+
+#include <vamp/vamp.h>
+#include <vamp-sdk/PluginAdapter.h>
+
+#include "TuningDifference.h"
+
+static Vamp::PluginAdapter<TuningDifference> tdAdapter;
+
+
+const VampPluginDescriptor *
+vampGetPluginDescriptor(unsigned int version, unsigned int index)
+{
+    if (version < 1) return 0;
+
+    switch (index) {
+    case  0: return tdAdapter.getDescriptor();
+    default: return 0;
+    }
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vamp-plugin.list	Fri Jan 23 17:41:22 2015 +0000
@@ -0,0 +1,1 @@
+_vampGetPluginDescriptor
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vamp-plugin.map	Fri Jan 23 17:41:22 2015 +0000
@@ -0,0 +1,4 @@
+{
+	global: vampGetPluginDescriptor;
+	local: *;
+};