mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-26 15:20:21 +01:00
Update libvamp to 2.5.
This commit is contained in:
101
lib-src/libvamp/skeleton/Makefile.skeleton
Normal file
101
lib-src/libvamp/skeleton/Makefile.skeleton
Normal file
@@ -0,0 +1,101 @@
|
||||
|
||||
## Skeleton Makefile for Vamp plugin builds using command-line tools.
|
||||
## This requires GNU make, which is what you get with OS/X, Linux, or
|
||||
## MinGW/Cygwin on Windows.
|
||||
##
|
||||
## Rename this to Makefile, and edit as appropriate.
|
||||
## This Makefile WILL NOT WORK until you have edited it as described
|
||||
## below -- the Makefile as supplied does nothing useful at all!
|
||||
##
|
||||
## Various sets of options are provided, commented out -- just uncomment
|
||||
## (remove the '#' characters for) the set that most closely resembles
|
||||
## your own situation, and adjust to taste. Then run "gmake".
|
||||
##
|
||||
## (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 := myplugins
|
||||
|
||||
# Edit this to list the .cpp or .c files in your plugin project
|
||||
#
|
||||
PLUGIN_SOURCES := MyPlugin.cpp plugins.cpp
|
||||
|
||||
# Edit this to list the .h files in your plugin project
|
||||
#
|
||||
PLUGIN_HEADERS := MyPlugin.h
|
||||
|
||||
# Edit this to the location of the Vamp plugin SDK, relative to your
|
||||
# project directory
|
||||
#
|
||||
VAMP_SDK_DIR := ../vamp-plugin-sdk
|
||||
|
||||
|
||||
## Uncomment these for an OS/X universal binary (32- and 64-bit Intel)
|
||||
## supporting 10.5 or newer. Use this if you have OS/X 10.7 with the
|
||||
## Xcode 4 command-line tools.
|
||||
|
||||
# CXX := g++
|
||||
# CXXFLAGS := -mmacosx-version-min=10.5 -arch i386 -arch x86_64 -I$(VAMP_SDK_DIR) -Wall -fPIC
|
||||
# PLUGIN_EXT := .dylib
|
||||
# LDFLAGS := $(CXXFLAGS) -dynamiclib -install_name $(PLUGIN_LIBRARY_NAME)$(PLUGIN_EXT) $(VAMP_SDK_DIR)/libvamp-sdk.a -exported_symbols_list vamp-plugin.list
|
||||
|
||||
|
||||
## Uncomment these for an OS/X universal binary (PPC and 32- and
|
||||
## 64-bit Intel) supporting 10.5 or newer. Use this if you have OS/X
|
||||
## 10.6 with the Xcode 3 command-line tools.
|
||||
|
||||
# CXXFLAGS := -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -arch i386 -arch x86_64 -arch ppc -I$(VAMP_SDK_DIR) -Wall -fPIC
|
||||
# PLUGIN_EXT := .dylib
|
||||
# LDFLAGS := $(CXXFLAGS) -dynamiclib -install_name $(PLUGIN_LIBRARY_NAME)$(PLUGIN_EXT) $(VAMP_SDK_DIR)/libvamp-sdk.a -exported_symbols_list vamp-plugin.list
|
||||
|
||||
|
||||
## Uncomment these for an OS/X universal binary (PPC and 32- and
|
||||
## 64-bit Intel) supporting 10.4 or newer. Use this if you have OS/X
|
||||
## 10.4, 10.5 or 10.6 and you have the 10.4 SDK installed.
|
||||
|
||||
# CXX := g++-4.0
|
||||
# CXXFLAGS := -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -arch i386 -arch x86_64 -arch ppc -I$(VAMP_SDK_DIR) -Wall -fPIC
|
||||
# PLUGIN_EXT := .dylib
|
||||
# LDFLAGS := $(CXXFLAGS) -dynamiclib -install_name $(PLUGIN_LIBRARY_NAME)$(PLUGIN_EXT) $(VAMP_SDK_DIR)/libvamp-sdk.a -exported_symbols_list vamp-plugin.list
|
||||
|
||||
|
||||
## Uncomment these for Linux using the standard tools:
|
||||
|
||||
# CXXFLAGS := -I$(VAMP_SDK_DIR) -Wall -fPIC
|
||||
# PLUGIN_EXT := .so
|
||||
# LDFLAGS := -shared -Wl,-soname=$(PLUGIN_LIBRARY_NAME)$(PLUGIN_EXT) $(VAMP_SDK_DIR)/libvamp-sdk.a -Wl,--version-script=vamp-plugin.map
|
||||
|
||||
|
||||
## Uncomment these for a cross-compile from Linux to Windows using MinGW:
|
||||
|
||||
# CXX := i586-mingw32msvc-g++
|
||||
# CXXFLAGS := -I$(VAMP_SDK_DIR) -Wall
|
||||
# PLUGIN_EXT := .dll
|
||||
# LDFLAGS := --static-libgcc -Wl,-soname=$(PLUGIN_LIBRARY_NAME)$(PLUGIN_EXT) -shared $(VAMP_SDK_DIR)/libvamp-sdk.a
|
||||
|
||||
|
||||
## Uncomment these for OpenSolaris using SunStudio compiler and GNU make:
|
||||
|
||||
# CXX := CC
|
||||
# CXXFLAGS := -G -I$(VAMP_SDK_DIR) +w -KPIC
|
||||
# PLUGIN_EXT := .so
|
||||
# LDFLAGS := -G -h$(PLUGIN_LIBRARY_NAME)$(PLUGIN_EXT) $(VAMP_SDK_DIR)/libvamp-sdk.a -Qoption ld -Mvamp-plugin.map
|
||||
|
||||
|
||||
|
||||
## All of the above
|
||||
|
||||
PLUGIN_OBJECTS := $(PLUGIN_SOURCES:.cpp=.o)
|
||||
PLUGIN_OBJECTS := $(PLUGIN_OBJECTS:.c=.o)
|
||||
|
||||
$(PLUGIN_LIBRARY_NAME)$(PLUGIN_EXT): $(PLUGIN_OBJECTS)
|
||||
$(CXX) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
$(PLUGIN_OBJECTS): $(PLUGIN_HEADERS)
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
|
||||
220
lib-src/libvamp/skeleton/MyPlugin.cpp
Normal file
220
lib-src/libvamp/skeleton/MyPlugin.cpp
Normal file
@@ -0,0 +1,220 @@
|
||||
|
||||
// This is a skeleton file for use in creating your own plugin
|
||||
// libraries. Replace MyPlugin and myPlugin throughout with the name
|
||||
// of your first plugin class, and fill in the gaps as appropriate.
|
||||
|
||||
|
||||
#include "MyPlugin.h"
|
||||
|
||||
|
||||
MyPlugin::MyPlugin(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
|
||||
{
|
||||
}
|
||||
|
||||
MyPlugin::~MyPlugin()
|
||||
{
|
||||
}
|
||||
|
||||
string
|
||||
MyPlugin::getIdentifier() const
|
||||
{
|
||||
return "myplugin";
|
||||
}
|
||||
|
||||
string
|
||||
MyPlugin::getName() const
|
||||
{
|
||||
return "My Plugin";
|
||||
}
|
||||
|
||||
string
|
||||
MyPlugin::getDescription() const
|
||||
{
|
||||
// Return something helpful here!
|
||||
return "";
|
||||
}
|
||||
|
||||
string
|
||||
MyPlugin::getMaker() const
|
||||
{
|
||||
// Your name here
|
||||
return "";
|
||||
}
|
||||
|
||||
int
|
||||
MyPlugin::getPluginVersion() const
|
||||
{
|
||||
// Increment this each time you release a version that behaves
|
||||
// differently from the previous one
|
||||
return 1;
|
||||
}
|
||||
|
||||
string
|
||||
MyPlugin::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 "";
|
||||
}
|
||||
|
||||
MyPlugin::InputDomain
|
||||
MyPlugin::getInputDomain() const
|
||||
{
|
||||
return TimeDomain;
|
||||
}
|
||||
|
||||
size_t
|
||||
MyPlugin::getPreferredBlockSize() const
|
||||
{
|
||||
return 0; // 0 means "I can handle any block size"
|
||||
}
|
||||
|
||||
size_t
|
||||
MyPlugin::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
|
||||
MyPlugin::getMinChannelCount() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
size_t
|
||||
MyPlugin::getMaxChannelCount() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
MyPlugin::ParameterList
|
||||
MyPlugin::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
|
||||
MyPlugin::getParameter(string identifier) const
|
||||
{
|
||||
if (identifier == "parameter") {
|
||||
return 5; // return the ACTUAL current value of your parameter here!
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
MyPlugin::setParameter(string identifier, float value)
|
||||
{
|
||||
if (identifier == "parameter") {
|
||||
// set the actual value of your parameter
|
||||
}
|
||||
}
|
||||
|
||||
MyPlugin::ProgramList
|
||||
MyPlugin::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
|
||||
MyPlugin::getCurrentProgram() const
|
||||
{
|
||||
return ""; // no programs
|
||||
}
|
||||
|
||||
void
|
||||
MyPlugin::selectProgram(string name)
|
||||
{
|
||||
}
|
||||
|
||||
MyPlugin::OutputList
|
||||
MyPlugin::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
|
||||
MyPlugin::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
|
||||
MyPlugin::reset()
|
||||
{
|
||||
// Clear buffers, reset stored values, etc
|
||||
}
|
||||
|
||||
MyPlugin::FeatureSet
|
||||
MyPlugin::process(const float *const *inputBuffers, Vamp::RealTime timestamp)
|
||||
{
|
||||
// Do actual work!
|
||||
return FeatureSet();
|
||||
}
|
||||
|
||||
MyPlugin::FeatureSet
|
||||
MyPlugin::getRemainingFeatures()
|
||||
{
|
||||
return FeatureSet();
|
||||
}
|
||||
|
||||
59
lib-src/libvamp/skeleton/MyPlugin.h
Normal file
59
lib-src/libvamp/skeleton/MyPlugin.h
Normal file
@@ -0,0 +1,59 @@
|
||||
|
||||
// This is a skeleton file for use in creating your own plugin
|
||||
// libraries. Replace MyPlugin and myPlugin throughout with the name
|
||||
// of your first plugin class, and fill in the gaps as appropriate.
|
||||
|
||||
|
||||
// Remember to use a different guard symbol in each header!
|
||||
#ifndef _MY_PLUGIN_H_
|
||||
#define _MY_PLUGIN_H_
|
||||
|
||||
#include <vamp-sdk/Plugin.h>
|
||||
|
||||
using std::string;
|
||||
|
||||
|
||||
class MyPlugin : public Vamp::Plugin
|
||||
{
|
||||
public:
|
||||
MyPlugin(float inputSampleRate);
|
||||
virtual ~MyPlugin();
|
||||
|
||||
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
|
||||
37
lib-src/libvamp/skeleton/plugins.cpp
Normal file
37
lib-src/libvamp/skeleton/plugins.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
// This is a skeleton file for use in creating your own plugin
|
||||
// libraries. Replace MyPlugin and myPlugin throughout with the name
|
||||
// of your first plugin class, and fill in the gaps as appropriate.
|
||||
|
||||
|
||||
#include <vamp/vamp.h>
|
||||
#include <vamp-sdk/PluginAdapter.h>
|
||||
|
||||
#include "MyPlugin.h"
|
||||
|
||||
|
||||
// Declare one static adapter here for each plugin class in this library.
|
||||
|
||||
static Vamp::PluginAdapter<MyPlugin> myPluginAdapter;
|
||||
|
||||
|
||||
// This is the entry-point for the library, and the only function that
|
||||
// needs to be publicly exported.
|
||||
|
||||
const VampPluginDescriptor *
|
||||
vampGetPluginDescriptor(unsigned int version, unsigned int index)
|
||||
{
|
||||
if (version < 1) return 0;
|
||||
|
||||
// Return a different plugin adaptor's descriptor for each index,
|
||||
// and return 0 for the first index after you run out of plugins.
|
||||
// (That's how the host finds out how many plugins are in this
|
||||
// library.)
|
||||
|
||||
switch (index) {
|
||||
case 0: return myPluginAdapter.getDescriptor();
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1
lib-src/libvamp/skeleton/vamp-plugin.list
Normal file
1
lib-src/libvamp/skeleton/vamp-plugin.list
Normal file
@@ -0,0 +1 @@
|
||||
_vampGetPluginDescriptor
|
||||
4
lib-src/libvamp/skeleton/vamp-plugin.map
Normal file
4
lib-src/libvamp/skeleton/vamp-plugin.map
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
global: vampGetPluginDescriptor;
|
||||
local: *;
|
||||
};
|
||||
Reference in New Issue
Block a user