Mercurial > hg > vamp-plugin-sdk
changeset 337:d5c5a52e6c9f
Make the simple base-fft implementation accessible for use by plugins as well. Bump version to 2.4
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Thu Jul 12 11:37:31 2012 +0100 @@ -0,0 +1,15 @@ +syntax: glob +doc/ +*.o +autom4te* +*.m4 +*.a +*.so +*.orig +*~ +host/vamp-simple-host +rdf/generator/vamp-rdf-template-generator +config.log +config.status +Makefile +
--- a/CHANGELOG Mon Jul 09 22:36:06 2012 +0100 +++ b/CHANGELOG Thu Jul 12 11:37:31 2012 +0100 @@ -1,8 +1,13 @@ -Version 2.3.1, TBA (maintenance release): +Version 2.4, TBA (maintenance and minor feature release): + * Provide a simple FFT implementation as a convenience for plugins + * Add symbols to make the library versions discoverable by autoconf + using C linkage * Fix failure to open plugins from Unicode builds on Windows (thanks RJ Ryan) + * Fix thread-safety issue in PluginInputDomainAdapter + * Add build for OS/X 10.7+/Xcode 4; remove build for OpenSolaris Version 2.3, 2011-09-28 (minor feature release):
--- a/Makefile.in Mon Jul 09 22:36:06 2012 +0100 +++ b/Makefile.in Thu Jul 12 11:37:31 2012 +0100 @@ -75,13 +75,13 @@ INSTALL_PLUGINS = $(INSTALL_PREFIX)/lib/vamp INSTALL_BINARIES = $(INSTALL_PREFIX)/bin -INSTALL_SDK_LIBNAME = libvamp-sdk.so.2.3.0 +INSTALL_SDK_LIBNAME = libvamp-sdk.so.2.4.0 INSTALL_SDK_LINK_ABI = libvamp-sdk.so.2 INSTALL_SDK_LINK_DEV = libvamp-sdk.so INSTALL_SDK_STATIC = libvamp-sdk.a INSTALL_SDK_LA = libvamp-sdk.la -INSTALL_HOSTSDK_LIBNAME = libvamp-hostsdk.so.3.3.0 +INSTALL_HOSTSDK_LIBNAME = libvamp-hostsdk.so.3.4.0 INSTALL_HOSTSDK_LINK_ABI = libvamp-hostsdk.so.3 INSTALL_HOSTSDK_LINK_DEV = libvamp-hostsdk.so INSTALL_HOSTSDK_STATIC = libvamp-hostsdk.a @@ -119,6 +119,7 @@ $(SDKDIR)/PluginAdapter.h \ $(SDKDIR)/PluginBase.h \ $(SDKDIR)/RealTime.h \ + $(SDKDIR)/FFT.h \ $(SDKDIR)/plugguard.h \ $(SDKDIR)/vamp-sdk.h @@ -139,6 +140,7 @@ SDK_OBJECTS = \ $(SDKSRCDIR)/PluginAdapter.o \ $(SDKSRCDIR)/RealTime.o \ + $(SDKSRCDIR)/FFT.o \ $(SDKSRCDIR)/acsymbols.o HOSTSDK_OBJECTS = \ @@ -363,6 +365,7 @@ src/vamp-sdk/PluginAdapter.o: vamp-sdk/Plugin.h vamp-sdk/PluginBase.h src/vamp-sdk/PluginAdapter.o: vamp-sdk/plugguard.h vamp-sdk/RealTime.h src/vamp-sdk/RealTime.o: ./vamp-sdk/RealTime.h vamp-sdk/plugguard.h +src/vamp-sdk/FFT.o: src/vamp-sdk/FFT.cpp vamp-sdk/FFT.h src/vamp-sdk/FFTimpl.cpp src/vamp-hostsdk/PluginBufferingAdapter.o: ./vamp-hostsdk/PluginBufferingAdapter.h src/vamp-hostsdk/PluginBufferingAdapter.o: ./vamp-hostsdk/PluginWrapper.h src/vamp-hostsdk/PluginBufferingAdapter.o: ./vamp-hostsdk/Plugin.h @@ -387,6 +390,8 @@ src/vamp-hostsdk/PluginInputDomainAdapter.o: vamp-sdk/PluginBase.h src/vamp-hostsdk/PluginInputDomainAdapter.o: vamp-sdk/plugguard.h src/vamp-hostsdk/PluginInputDomainAdapter.o: vamp-sdk/RealTime.h +src/vamp-hostsdk/PluginInputDomainAdapter.o: vamp-sdk/FFT.h +src/vamp-hostsdk/PluginInputDomainAdapter.o: src/vamp-sdk/FFTimpl.cpp src/vamp-hostsdk/PluginLoader.o: ./vamp-hostsdk/PluginHostAdapter.h src/vamp-hostsdk/PluginLoader.o: vamp/vamp.h vamp-sdk/Plugin.h src/vamp-hostsdk/PluginLoader.o: vamp-sdk/PluginBase.h
--- a/README Mon Jul 09 22:36:06 2012 +0100 +++ b/README Thu Jul 12 11:37:31 2012 +0100 @@ -9,7 +9,7 @@ Vamp is an API for C and C++ plugins that process sampled audio data to produce descriptive output (measurements or semantic observations). -This is version 2.3.1 of the Vamp plugin Software Development Kit. +This is version 2.4 of the Vamp plugin Software Development Kit. Plugins and hosts built with this SDK are binary compatible with those built using version 1.0 of the SDK, with certain restrictions. See
--- a/build/Doxyfile Mon Jul 09 22:36:06 2012 +0100 +++ b/build/Doxyfile Thu Jul 12 11:37:31 2012 +0100 @@ -31,7 +31,7 @@ # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 2.3 +PROJECT_NUMBER = 2.4 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put.
--- a/build/Makefile.mingw32 Mon Jul 09 22:36:06 2012 +0100 +++ b/build/Makefile.mingw32 Thu Jul 12 11:37:31 2012 +0100 @@ -111,6 +111,7 @@ $(SDKDIR)/PluginAdapter.h \ $(SDKDIR)/PluginBase.h \ $(SDKDIR)/RealTime.h \ + $(SDKDIR)/FFT.h \ $(SDKDIR)/plugguard.h \ $(SDKDIR)/vamp-sdk.h @@ -131,6 +132,7 @@ SDK_OBJECTS = \ $(SDKSRCDIR)/PluginAdapter.o \ $(SDKSRCDIR)/RealTime.o \ + $(SDKSRCDIR)/FFT.o \ $(SDKSRCDIR)/acsymbols.o HOSTSDK_OBJECTS = \
--- a/build/Makefile.osx Mon Jul 09 22:36:06 2012 +0100 +++ b/build/Makefile.osx Thu Jul 12 11:37:31 2012 +0100 @@ -124,6 +124,7 @@ $(SDKDIR)/PluginAdapter.h \ $(SDKDIR)/PluginBase.h \ $(SDKDIR)/RealTime.h \ + $(SDKDIR)/FFT.h \ $(SDKDIR)/plugguard.h \ $(SDKDIR)/vamp-sdk.h @@ -144,6 +145,7 @@ SDK_OBJECTS = \ $(SDKSRCDIR)/PluginAdapter.o \ $(SDKSRCDIR)/RealTime.o \ + $(SDKSRCDIR)/FFT.o \ $(SDKSRCDIR)/acsymbols.o HOSTSDK_OBJECTS = \
--- a/build/Makefile.osx.106 Mon Jul 09 22:36:06 2012 +0100 +++ b/build/Makefile.osx.106 Thu Jul 12 11:37:31 2012 +0100 @@ -145,6 +145,7 @@ $(SDKDIR)/PluginAdapter.h \ $(SDKDIR)/PluginBase.h \ $(SDKDIR)/RealTime.h \ + $(SDKDIR)/FFT.h \ $(SDKDIR)/plugguard.h \ $(SDKDIR)/vamp-sdk.h @@ -165,6 +166,7 @@ SDK_OBJECTS = \ $(SDKSRCDIR)/PluginAdapter.o \ $(SDKSRCDIR)/RealTime.o \ + $(SDKSRCDIR)/FFT.o \ $(SDKSRCDIR)/acsymbols.o HOSTSDK_OBJECTS = \
--- a/build/VampPluginSDK.vcproj Mon Jul 09 22:36:06 2012 +0100 +++ b/build/VampPluginSDK.vcproj Thu Jul 12 11:37:31 2012 +0100 @@ -163,6 +163,10 @@ > </File> <File + RelativePath="..\vamp-sdk\FFT.h" + > + </File> + <File RelativePath="..\vamp-sdk\RealTime.h" > </File> @@ -187,6 +191,10 @@ > </File> <File + RelativePath="..\src\vamp-sdk\FFT.cpp" + > + </File> + <File RelativePath="..\src\vamp-sdk\RealTime.cpp" > </File>
--- a/build/libvamp-hostsdk.la.in Mon Jul 09 22:36:06 2012 +0100 +++ b/build/libvamp-hostsdk.la.in Thu Jul 12 11:37:31 2012 +0100 @@ -3,7 +3,7 @@ old_library='%STATIC%' dependency_libs='' current=3 -age=3 +age=4 revision=0 installed=yes libdir='%LIBS%'
--- a/build/libvamp-sdk.la.in Mon Jul 09 22:36:06 2012 +0100 +++ b/build/libvamp-sdk.la.in Thu Jul 12 11:37:31 2012 +0100 @@ -3,7 +3,7 @@ old_library='%STATIC%' dependency_libs='' current=2 -age=3 +age=4 revision=0 installed=yes libdir='%LIBS%'
--- a/build/update-version.sh Mon Jul 09 22:36:06 2012 +0100 +++ b/build/update-version.sh Thu Jul 12 11:37:31 2012 +0100 @@ -60,17 +60,35 @@ $p 's/(age)=.*/$1='$hostminor'/' \ build/libvamp-hostsdk.la.in +$p 's/(PROJECT_NUMBER[^=]*)=.*/$1= '$version'/' \ + build/Doxyfile + $p 's/(VAMP_API_VERSION).*/$1 '$major'/' \ vamp/vamp.h $p 's/(VAMP_SDK_VERSION) +"[^"]*"/$1 "'$version'"/' \ - vamp-sdk/PluginBase.h + vamp-sdk/plugguard.h $p 's/(VAMP_SDK_MAJOR_VERSION).*/$1 '$major'/' \ - vamp-sdk/PluginBase.h + vamp-sdk/plugguard.h $p 's/(VAMP_SDK_MINOR_VERSION).*/$1 '$minor'/' \ - vamp-sdk/PluginBase.h + vamp-sdk/plugguard.h + +$p 's/(VAMP_SDK_VERSION) +"[^"]*"/$1 "'$version'"/' \ + vamp-hostsdk/hostguard.h + +$p 's/(VAMP_SDK_MAJOR_VERSION).*/$1 '$major'/' \ + vamp-hostsdk/hostguard.h + +$p 's/(VAMP_SDK_MINOR_VERSION).*/$1 '$minor'/' \ + vamp-hostsdk/hostguard.h + +$p 's/(VAMP_SDK_MAJOR_VERSION !=) [\d\.]+/$1 '$major'/' \ + src/vamp-sdk/FFT.cpp + +$p 's/(VAMP_SDK_MINOR_VERSION !=) [\d\.]+/$1 '$minor'/' \ + src/vamp-sdk/FFT.cpp $p 's/(VAMP_SDK_MAJOR_VERSION !=) [\d\.]+/$1 '$major'/' \ src/vamp-sdk/PluginAdapter.cpp @@ -88,9 +106,11 @@ $p 's/(Version:) .*/$1 '$version'/' $pc done -$p 's/^$/\nextern void libvampsdk_v_'$acs'_present(void) { }/' \ +fgrep -q 'libvampsdk_v_'$acs'_present' src/vamp-sdk/acsymbols.c || \ + $p 's/^$/\nextern void libvampsdk_v_'$acs'_present(void) { }/' \ src/vamp-sdk/acsymbols.c +fgrep -q 'libvamphostsdk_v_'$acs'_present' src/vamp-hostsdk/acsymbols.c || \ $p 's/^$/\nextern void libvamphostsdk_v_'$acs'_present(void) { }/' \ src/vamp-hostsdk/acsymbols.c
--- a/configure.ac Mon Jul 09 22:36:06 2012 +0100 +++ b/configure.ac Thu Jul 12 11:37:31 2012 +0100 @@ -1,5 +1,5 @@ -AC_INIT(vamp-plugin-sdk, 2.3.1, cannam@all-day-breakfast.com) +AC_INIT(vamp-plugin-sdk, 2.4, cannam@all-day-breakfast.com) AC_CONFIG_SRCDIR(vamp/vamp.h) AC_PROG_CXX
--- a/pkgconfig/vamp-hostsdk.pc.in Mon Jul 09 22:36:06 2012 +0100 +++ b/pkgconfig/vamp-hostsdk.pc.in Thu Jul 12 11:37:31 2012 +0100 @@ -4,7 +4,7 @@ includedir=${prefix}/include Name: vamp-hostsdk -Version: 2.3.1 +Version: 2.4 Description: Development library for Vamp audio analysis plugin hosts Libs: -L${libdir} -lvamp-hostsdk -ldl Cflags: -I${includedir}
--- a/pkgconfig/vamp-sdk.pc.in Mon Jul 09 22:36:06 2012 +0100 +++ b/pkgconfig/vamp-sdk.pc.in Thu Jul 12 11:37:31 2012 +0100 @@ -4,7 +4,7 @@ includedir=${prefix}/include Name: vamp-sdk -Version: 2.3.1 +Version: 2.4 Description: Development library for Vamp audio analysis plugins Libs: -L${libdir} -lvamp-sdk Cflags: -I${includedir}
--- a/pkgconfig/vamp.pc.in Mon Jul 09 22:36:06 2012 +0100 +++ b/pkgconfig/vamp.pc.in Thu Jul 12 11:37:31 2012 +0100 @@ -4,7 +4,7 @@ includedir=${prefix}/include Name: vamp -Version: 2.3.1 +Version: 2.4 Description: An API for audio analysis and feature extraction plugins Libs: Cflags: -I${includedir}
--- a/skeleton/Makefile.skeleton Mon Jul 09 22:36:06 2012 +0100 +++ b/skeleton/Makefile.skeleton Thu Jul 12 11:37:31 2012 +0100 @@ -33,8 +33,28 @@ 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.4 or newer (if you have the 10.4 SDK): +## 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 @@ -42,15 +62,6 @@ # 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 the -## default 10.6 developer 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 Linux using the standard tools: # CXXFLAGS := -I$(VAMP_SDK_DIR) -Wall -fPIC
--- a/src/doc-overview Mon Jul 09 22:36:06 2012 +0100 +++ b/src/doc-overview Thu Jul 12 11:37:31 2012 +0100 @@ -62,6 +62,9 @@ results used in the calculation, and may be a useful example of a plugin having several outputs with varying feature structures. +Plugin authors should also read the Programmer's Guide at +http://vamp-plugins.org/guide.pdf . + \section hosts For Hosts Hosts will normally use a Vamp::PluginHostAdapter to convert each
--- a/src/vamp-hostsdk/PluginHostAdapter.cpp Mon Jul 09 22:36:06 2012 +0100 +++ b/src/vamp-hostsdk/PluginHostAdapter.cpp Thu Jul 12 11:37:31 2012 +0100 @@ -37,7 +37,7 @@ #include <vamp-hostsdk/PluginHostAdapter.h> #include <cstdlib> -#if ( VAMP_SDK_MAJOR_VERSION != 2 || VAMP_SDK_MINOR_VERSION != 3 ) +#if ( VAMP_SDK_MAJOR_VERSION != 2 || VAMP_SDK_MINOR_VERSION != 4 ) #error Unexpected version of Vamp SDK header included #endif
--- a/src/vamp-hostsdk/PluginInputDomainAdapter.cpp Mon Jul 09 22:36:06 2012 +0100 +++ b/src/vamp-hostsdk/PluginInputDomainAdapter.cpp Thu Jul 12 11:37:31 2012 +0100 @@ -69,6 +69,8 @@ */ #ifdef HAVE_FFTW3 #include <fftw3.h> +#else +#include "../vamp-sdk/FFTimpl.cpp" #endif @@ -123,8 +125,6 @@ #else double *m_ro; double *m_io; - void fft(unsigned int n, bool inverse, - double *ri, double *ii, double *ro, double *io); #endif FeatureSet processShiftingTimestamp(const float *const *inputBuffers, RealTime timestamp); @@ -601,110 +601,6 @@ #ifndef HAVE_FFTW3 -void -PluginInputDomainAdapter::Impl::fft(unsigned int n, bool inverse, - double *ri, double *ii, double *ro, double *io) -{ - if (!ri || !ro || !io) return; - - unsigned int bits; - unsigned int i, j, k, m; - unsigned int blockSize, blockEnd; - - double tr, ti; - - if (n < 2) return; - if (n & (n-1)) return; - - double angle = 2.0 * M_PI; - if (inverse) angle = -angle; - - for (i = 0; ; ++i) { - if (n & (1 << i)) { - bits = i; - break; - } - } - - int table[n]; - - for (i = 0; i < n; ++i) { - m = i; - for (j = k = 0; j < bits; ++j) { - k = (k << 1) | (m & 1); - m >>= 1; - } - table[i] = k; - } - - if (ii) { - for (i = 0; i < n; ++i) { - ro[table[i]] = ri[i]; - io[table[i]] = ii[i]; - } - } else { - for (i = 0; i < n; ++i) { - ro[table[i]] = ri[i]; - io[table[i]] = 0.0; - } - } - - blockEnd = 1; - - for (blockSize = 2; blockSize <= n; blockSize <<= 1) { - - double delta = angle / (double)blockSize; - double sm2 = -sin(-2 * delta); - double sm1 = -sin(-delta); - double cm2 = cos(-2 * delta); - double cm1 = cos(-delta); - double w = 2 * cm1; - double ar[3], ai[3]; - - for (i = 0; i < n; i += blockSize) { - - ar[2] = cm2; - ar[1] = cm1; - - ai[2] = sm2; - ai[1] = sm1; - - for (j = i, m = 0; m < blockEnd; j++, m++) { - - ar[0] = w * ar[1] - ar[2]; - ar[2] = ar[1]; - ar[1] = ar[0]; - - ai[0] = w * ai[1] - ai[2]; - ai[2] = ai[1]; - ai[1] = ai[0]; - - k = j + blockEnd; - tr = ar[0] * ro[k] - ai[0] * io[k]; - ti = ar[0] * io[k] + ai[0] * ro[k]; - - ro[k] = ro[j] - tr; - io[k] = io[j] - ti; - - ro[j] += tr; - io[j] += ti; - } - } - - blockEnd = blockSize; - } - - if (inverse) { - - double denom = (double)n; - - for (i = 0; i < n; i++) { - ro[i] /= denom; - io[i] /= denom; - } - } -} - #endif }
--- a/src/vamp-hostsdk/PluginSummarisingAdapter.cpp Mon Jul 09 22:36:06 2012 +0100 +++ b/src/vamp-hostsdk/PluginSummarisingAdapter.cpp Thu Jul 12 11:37:31 2012 +0100 @@ -566,8 +566,6 @@ if (acount == 0) continue; - RealTime prevTimestamp = i->second; - #ifdef DEBUG_PLUGIN_SUMMARISING_ADAPTER std::cerr << "output " << output << ": "; #endif @@ -632,7 +630,6 @@ PluginSummarisingAdapter::Impl::segment() { SegmentBoundaries::iterator boundaryitr = m_boundaries.begin(); - RealTime segmentStart = RealTime::zeroTime; #ifdef DEBUG_PLUGIN_SUMMARISING_ADAPTER_SEGMENT std::cerr << "segment: starting" << std::endl;
--- a/src/vamp-hostsdk/acsymbols.c Mon Jul 09 22:36:06 2012 +0100 +++ b/src/vamp-hostsdk/acsymbols.c Thu Jul 12 11:37:31 2012 +0100 @@ -1,6 +1,7 @@ /* These stubs are provided so that autoconf can check library * versions using C symbols only */ +extern void libvamphostsdk_v_2_4_present(void) { } extern void libvamphostsdk_v_2_3_1_present(void) { } extern void libvamphostsdk_v_2_3_present(void) { } extern void libvamphostsdk_v_2_2_1_present(void) { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/vamp-sdk/FFT.cpp Thu Jul 12 11:37:31 2012 +0100 @@ -0,0 +1,70 @@ +/* -*- 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-2012 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. +*/ + +#include <vamp-sdk/FFT.h> + +#include <cmath> + +#if ( VAMP_SDK_MAJOR_VERSION != 2 || VAMP_SDK_MINOR_VERSION != 4 ) +#error Unexpected version of Vamp SDK header included +#endif + +_VAMP_SDK_PLUGSPACE_BEGIN(FFT.cpp) + +namespace Vamp { + +#include "FFTimpl.cpp" + +void +FFT::forward(unsigned int n, + const double *ri, const double *ii, + double *ro, double *io) +{ + fft(n, false, ri, ii, ro, io); +} + +void +FFT::inverse(unsigned int n, + const double *ri, const double *ii, + double *ro, double *io) +{ + fft(n, true, ri, ii, ro, io); +} + +} + +_VAMP_SDK_PLUGSPACE_END(FFT.cpp) +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/vamp-sdk/FFTimpl.cpp Thu Jul 12 11:37:31 2012 +0100 @@ -0,0 +1,108 @@ + +/* Public domain FFT implementation from Don Cross. */ + +static void +fft(unsigned int n, bool inverse, + const double *ri, const double *ii, + double *ro, double *io) +{ + if (!ri || !ro || !io) return; + + unsigned int bits; + unsigned int i, j, k, m; + unsigned int blockSize, blockEnd; + + double tr, ti; + + if (n < 2) return; + if (n & (n-1)) return; + + double angle = 2.0 * M_PI; + if (inverse) angle = -angle; + + for (i = 0; ; ++i) { + if (n & (1 << i)) { + bits = i; + break; + } + } + + int table[n]; + + for (i = 0; i < n; ++i) { + m = i; + for (j = k = 0; j < bits; ++j) { + k = (k << 1) | (m & 1); + m >>= 1; + } + table[i] = k; + } + + if (ii) { + for (i = 0; i < n; ++i) { + ro[table[i]] = ri[i]; + io[table[i]] = ii[i]; + } + } else { + for (i = 0; i < n; ++i) { + ro[table[i]] = ri[i]; + io[table[i]] = 0.0; + } + } + + blockEnd = 1; + + for (blockSize = 2; blockSize <= n; blockSize <<= 1) { + + double delta = angle / (double)blockSize; + double sm2 = -sin(-2 * delta); + double sm1 = -sin(-delta); + double cm2 = cos(-2 * delta); + double cm1 = cos(-delta); + double w = 2 * cm1; + double ar[3], ai[3]; + + for (i = 0; i < n; i += blockSize) { + + ar[2] = cm2; + ar[1] = cm1; + + ai[2] = sm2; + ai[1] = sm1; + + for (j = i, m = 0; m < blockEnd; j++, m++) { + + ar[0] = w * ar[1] - ar[2]; + ar[2] = ar[1]; + ar[1] = ar[0]; + + ai[0] = w * ai[1] - ai[2]; + ai[2] = ai[1]; + ai[1] = ai[0]; + + k = j + blockEnd; + tr = ar[0] * ro[k] - ai[0] * io[k]; + ti = ar[0] * io[k] + ai[0] * ro[k]; + + ro[k] = ro[j] - tr; + io[k] = io[j] - ti; + + ro[j] += tr; + io[j] += ti; + } + } + + blockEnd = blockSize; + } + + if (inverse) { + + double denom = (double)n; + + for (i = 0; i < n; i++) { + ro[i] /= denom; + io[i] /= denom; + } + } +} +
--- a/src/vamp-sdk/PluginAdapter.cpp Mon Jul 09 22:36:06 2012 +0100 +++ b/src/vamp-sdk/PluginAdapter.cpp Thu Jul 12 11:37:31 2012 +0100 @@ -39,7 +39,7 @@ #include <cstring> #include <cstdlib> -#if ( VAMP_SDK_MAJOR_VERSION != 2 || VAMP_SDK_MINOR_VERSION != 3 ) +#if ( VAMP_SDK_MAJOR_VERSION != 2 || VAMP_SDK_MINOR_VERSION != 4 ) #error Unexpected version of Vamp SDK header included #endif
--- a/src/vamp-sdk/acsymbols.c Mon Jul 09 22:36:06 2012 +0100 +++ b/src/vamp-sdk/acsymbols.c Thu Jul 12 11:37:31 2012 +0100 @@ -1,6 +1,7 @@ /* These stubs are provided so that autoconf can check library * versions using C symbols only */ +extern void libvampsdk_v_2_4_present(void) { } extern void libvampsdk_v_2_3_1_present(void) { } extern void libvampsdk_v_2_3_present(void) { } extern void libvampsdk_v_2_2_1_present(void) { }
--- a/vamp-hostsdk/hostguard.h Mon Jul 09 22:36:06 2012 +0100 +++ b/vamp-hostsdk/hostguard.h Thu Jul 12 11:37:31 2012 +0100 @@ -43,6 +43,10 @@ #define _VAMP_IN_HOSTSDK +#define VAMP_SDK_VERSION "2.4" +#define VAMP_SDK_MAJOR_VERSION 2 +#define VAMP_SDK_MINOR_VERSION 4 + #ifdef _VAMP_NO_HOST_NAMESPACE #define _VAMP_SDK_HOSTSPACE_BEGIN(h) #define _VAMP_SDK_HOSTSPACE_END(h)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vamp-sdk/FFT.h Thu Jul 12 11:37:31 2012 +0100 @@ -0,0 +1,98 @@ +/* -*- 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-2012 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_FFT_H_ +#define _VAMP_FFT_H_ + +#include "plugguard.h" +_VAMP_SDK_PLUGSPACE_BEGIN(FFT.h) + +namespace Vamp { + +/** + * A simple FFT implementation provided for convenience of plugin + * authors. + * + * This class provides double-precision FFTs in power-of-two sizes + * only. It is slower than more sophisticated library + * implementations. If these requirements aren't suitable, make other + * arrangements. + * + * The inverse transform is scaled by 1/n. + * + * The implementation is from Don Cross's public domain FFT code. + */ +class FFT +{ +public: + /** + * Calculate a forward transform of size n. + * + * ri and ii must point to the real and imaginary component arrays + * of the input. For real input, ii may be NULL. + * + * ro and io must point to enough space to receive the real and + * imaginary component arrays of the output. + * + * All input and output arrays are of size n. + */ + void forward(unsigned int n, + const double *ri, const double *ii, + double *ro, double *io); + + /** + * Calculate an inverse transform of size n. + * + * ri and ii must point to the real and imaginary component arrays + * of the input. For real input, ii may be NULL. + * + * ro and io must point to enough space to receive the real and + * imaginary component arrays of the output. The output is scaled + * by 1/n. The output pointers may not be NULL, even if the output + * is expected to be real. + * + * All input and output arrays are of size n. + */ + void inverse(unsigned int n, + const double *ri, const double *ii, + double *ro, double *io); +}; + +} + +_VAMP_SDK_PLUGSPACE_END(FFT.h) + +#endif
--- a/vamp-sdk/PluginBase.h Mon Jul 09 22:36:06 2012 +0100 +++ b/vamp-sdk/PluginBase.h Thu Jul 12 11:37:31 2012 +0100 @@ -40,10 +40,6 @@ #include <string> #include <vector> -#define VAMP_SDK_VERSION "2.3.1" -#define VAMP_SDK_MAJOR_VERSION 2 -#define VAMP_SDK_MINOR_VERSION 3 - #include "plugguard.h" _VAMP_SDK_PLUGSPACE_BEGIN(PluginBase.h)
--- a/vamp-sdk/plugguard.h Mon Jul 09 22:36:06 2012 +0100 +++ b/vamp-sdk/plugguard.h Thu Jul 12 11:37:31 2012 +0100 @@ -71,6 +71,10 @@ #define _VAMP_IN_PLUGINSDK 1 +#define VAMP_SDK_VERSION "2.4" +#define VAMP_SDK_MAJOR_VERSION 2 +#define VAMP_SDK_MINOR_VERSION 4 + #ifdef _VAMP_NO_PLUGIN_NAMESPACE #define _VAMP_SDK_PLUGSPACE_BEGIN(h) #define _VAMP_SDK_PLUGSPACE_END(h)