changeset 230:5ee166dccfff distinct-libraries

* Add include guards; make code compile!
author cannam
date Fri, 07 Nov 2008 14:11:39 +0000
parents 3451f7dfa2be
children 90e3acb4a728
files Makefile host/vamp-simple-host.cpp src/vamp-hostsdk/PluginHostAdapter.cpp src/vamp-hostsdk/RealTime.cpp src/vamp-hostsdk/hostext/PluginBufferingAdapter.cpp src/vamp-hostsdk/hostext/PluginChannelAdapter.cpp src/vamp-hostsdk/hostext/PluginInputDomainAdapter.cpp src/vamp-hostsdk/hostext/PluginLoader.cpp src/vamp-hostsdk/hostext/PluginSummarisingAdapter.cpp src/vamp-hostsdk/hostext/PluginWrapper.cpp src/vamp-sdk/PluginAdapter.cpp src/vamp-sdk/RealTime.cpp vamp-hostsdk/Plugin.h vamp-hostsdk/PluginBase.h vamp-hostsdk/PluginHostAdapter.h vamp-hostsdk/RealTime.h vamp-hostsdk/hostext/PluginWrapper.h vamp-hostsdk/hostguard.h vamp-sdk/Plugin.h vamp-sdk/PluginAdapter.h vamp-sdk/PluginBase.h vamp-sdk/RealTime.h vamp-sdk/plugguard.h
diffstat 23 files changed, 407 insertions(+), 152 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Thu Nov 06 16:55:15 2008 +0000
+++ b/Makefile	Fri Nov 07 14:11:39 2008 +0000
@@ -4,8 +4,16 @@
 # suit your operating system requirements.
 
 APIDIR		= vamp
+
 SDKDIR		= vamp-sdk
-HOSTEXTDIR      = vamp-sdk/hostext
+HOSTSDKDIR	= vamp-hostsdk
+HOSTEXTDIR      = vamp-hostsdk/hostext
+
+SRCDIR		= src
+SDKSRCDIR	= src/vamp-sdk
+HOSTSDKSRCDIR	= src/vamp-hostsdk
+HOSTEXTSRCDIR	= src/vamp-hostsdk/hostext
+
 EXAMPLEDIR	= examples
 HOSTDIR		= host
 
@@ -37,7 +45,7 @@
 
 # Libraries required for the plugins.
 #
-PLUGIN_LIBS	= $(SDKDIR)/libvamp-sdk.a
+PLUGIN_LIBS	= $(SRCDIR)/libvamp-sdk.a
 
 # File extension for a dynamically loadable object
 #
@@ -47,7 +55,7 @@
 
 # Libraries required for the host.
 #
-HOST_LIBS	= $(SDKDIR)/libvamp-hostsdk.a -lsndfile -ldl
+HOST_LIBS	= $(SRCDIR)/libvamp-hostsdk.a -lsndfile -ldl
 
 # Locations for "make install".  This will need quite a bit of 
 # editing for non-Linux platforms.  Of course you don't necessarily
@@ -82,7 +90,7 @@
 # Additional flags for making a plugin.  This version script tells the
 # GNU linker to make all symbols in the library hidden except for the
 # public entry point.  It's not essential, but makes a tidier library.
-PLUGIN_LDFLAGS		= $(DYNAMIC_LDFLAGS) -Wl,--version-script=vamp-plugin.map
+PLUGIN_LDFLAGS		= $(DYNAMIC_LDFLAGS) -Wl,--version-script=build/vamp-plugin.map
 
 
 ## For OS/X with g++:
@@ -105,10 +113,10 @@
 		$(SDKDIR)/RealTime.h
 
 HOSTSDK_HEADERS	= \
-		$(SDKDIR)/Plugin.h \
-		$(SDKDIR)/PluginBase.h \
-		$(SDKDIR)/PluginHostAdapter.h \
-		$(SDKDIR)/RealTime.h
+		$(HOSTSDKDIR)/Plugin.h \
+		$(HOSTSDKDIR)/PluginBase.h \
+		$(HOSTSDKDIR)/PluginHostAdapter.h \
+		$(HOSTSDKDIR)/RealTime.h
 
 HOSTEXT_HEADERS = \
 		$(HOSTEXTDIR)/PluginBufferingAdapter.h \
@@ -119,36 +127,36 @@
 		$(HOSTEXTDIR)/PluginWrapper.h
 
 SDK_OBJECTS	= \
-		$(SDKDIR)/PluginAdapter.o \
-		$(SDKDIR)/RealTime.o
+		$(SDKSRCDIR)/PluginAdapter.o \
+		$(SDKSRCDIR)/RealTime.o
 
 HOSTSDK_OBJECTS	= \
-		$(SDKDIR)/PluginHostAdapter.o \
-		$(HOSTEXTDIR)/PluginBufferingAdapter.o \
-		$(HOSTEXTDIR)/PluginChannelAdapter.o \
-		$(HOSTEXTDIR)/PluginInputDomainAdapter.o \
-		$(HOSTEXTDIR)/PluginLoader.o \
-		$(HOSTEXTDIR)/PluginSummarisingAdapter.o \
-		$(HOSTEXTDIR)/PluginWrapper.o \
-		$(SDKDIR)/RealTime.o
+		$(HOSTSDKSRCDIR)/PluginHostAdapter.o \
+		$(HOSTSDKSRCDIR)/RealTime.o \
+		$(HOSTEXTSRCDIR)/PluginBufferingAdapter.o \
+		$(HOSTEXTSRCDIR)/PluginChannelAdapter.o \
+		$(HOSTEXTSRCDIR)/PluginInputDomainAdapter.o \
+		$(HOSTEXTSRCDIR)/PluginLoader.o \
+		$(HOSTEXTSRCDIR)/PluginSummarisingAdapter.o \
+		$(HOSTEXTSRCDIR)/PluginWrapper.o
 
 SDK_STATIC	= \
-		$(SDKDIR)/libvamp-sdk.a
+		$(SRCDIR)/libvamp-sdk.a
 
 HOSTSDK_STATIC	= \
-		$(SDKDIR)/libvamp-hostsdk.a
+		$(SRCDIR)/libvamp-hostsdk.a
 
 SDK_DYNAMIC	= \
-		$(SDKDIR)/libvamp-sdk$(PLUGIN_EXT)
+		$(SRCDIR)/libvamp-sdk$(PLUGIN_EXT)
 
 HOSTSDK_DYNAMIC	= \
-		$(SDKDIR)/libvamp-hostsdk$(PLUGIN_EXT)
+		$(SRCDIR)/libvamp-hostsdk$(PLUGIN_EXT)
 
 SDK_LA		= \
-		$(SDKDIR)/libvamp-sdk.la
+		$(SRCDIR)/libvamp-sdk.la
 
 HOSTSDK_LA	= \
-		$(SDKDIR)/libvamp-hostsdk.la
+		$(SRCDIR)/libvamp-hostsdk.la
 
 PLUGIN_HEADERS	= \
 		$(EXAMPLEDIR)/SpectralCentroid.h \
@@ -257,102 +265,3 @@
 		    -e "s,%LIBS%,$(INSTALL_SDK_LIBS),g" $(HOSTSDK_LA).in \
 		> $(DESTDIR)$(INSTALL_SDK_LIBS)/$(INSTALL_HOSTSDK_LA)
 
-# DO NOT DELETE
-
-examples/AmplitudeFollower.o: vamp-sdk/Plugin.h vamp-sdk/PluginBase.h
-examples/AmplitudeFollower.o: vamp-sdk/RealTime.h
-examples/PercussionOnsetDetector.o: vamp-sdk/Plugin.h vamp-sdk/PluginBase.h
-examples/PercussionOnsetDetector.o: vamp-sdk/RealTime.h
-examples/FixedTempoEstimator.o: vamp-sdk/Plugin.h vamp-sdk/PluginBase.h
-examples/FixedTempoEstimator.o: vamp-sdk/RealTime.h
-examples/FixedTempoEstimator.o: examples/FixedTempoEstimator.h
-examples/SpectralCentroid.o: vamp-sdk/Plugin.h vamp-sdk/PluginBase.h
-examples/SpectralCentroid.o: vamp-sdk/RealTime.h
-examples/ZeroCrossing.o: vamp-sdk/Plugin.h vamp-sdk/PluginBase.h
-examples/ZeroCrossing.o: vamp-sdk/RealTime.h
-vamp-sdk/PluginAdapter.o: vamp-sdk/Plugin.h vamp-sdk/PluginBase.h
-vamp-sdk/PluginAdapter.o: vamp-sdk/RealTime.h
-vamp-sdk/Plugin.o: vamp-sdk/PluginBase.h vamp-sdk/RealTime.h
-vamp-sdk/PluginHostAdapter.o: vamp-sdk/Plugin.h vamp-sdk/PluginBase.h
-vamp-sdk/PluginHostAdapter.o: vamp-sdk/RealTime.h
-examples/AmplitudeFollower.o: examples/AmplitudeFollower.h vamp-sdk/Plugin.h
-examples/AmplitudeFollower.o: vamp-sdk/PluginBase.h vamp-sdk/RealTime.h
-examples/PercussionOnsetDetector.o: examples/PercussionOnsetDetector.h
-examples/PercussionOnsetDetector.o: vamp-sdk/Plugin.h vamp-sdk/PluginBase.h
-examples/PercussionOnsetDetector.o: vamp-sdk/RealTime.h
-examples/plugins.o: vamp/vamp.h vamp-sdk/PluginAdapter.h vamp-sdk/Plugin.h
-examples/plugins.o: vamp-sdk/PluginBase.h vamp-sdk/RealTime.h
-examples/plugins.o: examples/ZeroCrossing.h vamp-sdk/Plugin.h
-examples/plugins.o: examples/SpectralCentroid.h
-examples/plugins.o: examples/PercussionOnsetDetector.h
-examples/plugins.o: examples/FixedTempoEstimator.h
-examples/plugins.o: examples/AmplitudeFollower.h
-examples/SpectralCentroid.o: examples/SpectralCentroid.h vamp-sdk/Plugin.h
-examples/SpectralCentroid.o: vamp-sdk/PluginBase.h vamp-sdk/RealTime.h
-examples/ZeroCrossing.o: examples/ZeroCrossing.h vamp-sdk/Plugin.h
-examples/ZeroCrossing.o: vamp-sdk/PluginBase.h vamp-sdk/RealTime.h
-host/vamp-simple-host.o: vamp-sdk/PluginHostAdapter.h vamp-sdk/Plugin.h
-host/vamp-simple-host.o: vamp-sdk/PluginBase.h vamp-sdk/RealTime.h
-host/vamp-simple-host.o: vamp-sdk/hostext/PluginChannelAdapter.h
-host/vamp-simple-host.o: vamp-sdk/hostext/PluginWrapper.h
-host/vamp-simple-host.o: vamp-sdk/hostext/PluginInputDomainAdapter.h
-host/vamp-simple-host.o: vamp-sdk/hostext/PluginLoader.h vamp/vamp.h
-host/vamp-simple-host.o: host/system.h
-vamp-sdk/PluginAdapter.o: vamp-sdk/PluginAdapter.h vamp/vamp.h
-vamp-sdk/PluginAdapter.o: vamp-sdk/Plugin.h vamp-sdk/PluginBase.h
-vamp-sdk/PluginAdapter.o: vamp-sdk/RealTime.h
-vamp-sdk/PluginHostAdapter.o: vamp-sdk/PluginHostAdapter.h vamp/vamp.h
-vamp-sdk/PluginHostAdapter.o: vamp-sdk/Plugin.h vamp-sdk/PluginBase.h
-vamp-sdk/PluginHostAdapter.o: vamp-sdk/RealTime.h
-vamp-sdk/RealTime.o: vamp-sdk/RealTime.h
-vamp-sdk/hostext/PluginBufferingAdapter.o: vamp-sdk/hostext/PluginWrapper.h
-vamp-sdk/hostext/PluginBufferingAdapter.o: vamp-sdk/Plugin.h
-vamp-sdk/hostext/PluginBufferingAdapter.o: vamp-sdk/PluginBase.h
-vamp-sdk/hostext/PluginBufferingAdapter.o: vamp-sdk/RealTime.h
-vamp-sdk/hostext/PluginChannelAdapter.o: vamp-sdk/hostext/PluginWrapper.h
-vamp-sdk/hostext/PluginChannelAdapter.o: vamp-sdk/Plugin.h
-vamp-sdk/hostext/PluginChannelAdapter.o: vamp-sdk/PluginBase.h
-vamp-sdk/hostext/PluginChannelAdapter.o: vamp-sdk/RealTime.h
-vamp-sdk/hostext/PluginInputDomainAdapter.o: vamp-sdk/hostext/PluginWrapper.h
-vamp-sdk/hostext/PluginInputDomainAdapter.o: vamp-sdk/Plugin.h
-vamp-sdk/hostext/PluginInputDomainAdapter.o: vamp-sdk/PluginBase.h
-vamp-sdk/hostext/PluginInputDomainAdapter.o: vamp-sdk/RealTime.h
-vamp-sdk/hostext/PluginLoader.o: vamp-sdk/hostext/PluginWrapper.h
-vamp-sdk/hostext/PluginLoader.o: vamp-sdk/Plugin.h vamp-sdk/PluginBase.h
-vamp-sdk/hostext/PluginLoader.o: vamp-sdk/RealTime.h
-vamp-sdk/hostext/PluginWrapper.o: vamp-sdk/Plugin.h vamp-sdk/PluginBase.h
-vamp-sdk/hostext/PluginWrapper.o: vamp-sdk/RealTime.h
-rdf/generator/template-generator.o: vamp-sdk/PluginHostAdapter.h
-rdf/generator/template-generator.o: vamp-sdk/Plugin.h vamp-sdk/PluginBase.h
-rdf/generator/template-generator.o: vamp-sdk/RealTime.h
-rdf/generator/template-generator.o: vamp-sdk/hostext/PluginChannelAdapter.h
-rdf/generator/template-generator.o: vamp-sdk/hostext/PluginWrapper.h
-rdf/generator/template-generator.o: vamp-sdk/hostext/PluginInputDomainAdapter.h
-rdf/generator/template-generator.o: vamp-sdk/hostext/PluginLoader.h
-rdf/generator/template-generator.o: vamp/vamp.h
-vamp-sdk/hostext/PluginBufferingAdapter.o: vamp-sdk/hostext/PluginBufferingAdapter.h
-vamp-sdk/hostext/PluginBufferingAdapter.o: vamp-sdk/hostext/PluginWrapper.h
-vamp-sdk/hostext/PluginBufferingAdapter.o: vamp-sdk/Plugin.h
-vamp-sdk/hostext/PluginBufferingAdapter.o: vamp-sdk/PluginBase.h
-vamp-sdk/hostext/PluginBufferingAdapter.o: vamp-sdk/RealTime.h
-vamp-sdk/hostext/PluginChannelAdapter.o: vamp-sdk/hostext/PluginChannelAdapter.h
-vamp-sdk/hostext/PluginChannelAdapter.o: vamp-sdk/hostext/PluginWrapper.h
-vamp-sdk/hostext/PluginChannelAdapter.o: vamp-sdk/Plugin.h
-vamp-sdk/hostext/PluginChannelAdapter.o: vamp-sdk/PluginBase.h
-vamp-sdk/hostext/PluginChannelAdapter.o: vamp-sdk/RealTime.h
-vamp-sdk/hostext/PluginInputDomainAdapter.o: vamp-sdk/hostext/PluginInputDomainAdapter.h
-vamp-sdk/hostext/PluginInputDomainAdapter.o: vamp-sdk/hostext/PluginWrapper.h
-vamp-sdk/hostext/PluginInputDomainAdapter.o: vamp-sdk/Plugin.h
-vamp-sdk/hostext/PluginInputDomainAdapter.o: vamp-sdk/PluginBase.h
-vamp-sdk/hostext/PluginInputDomainAdapter.o: vamp-sdk/RealTime.h
-vamp-sdk/hostext/PluginLoader.o: vamp-sdk/PluginHostAdapter.h
-vamp-sdk/hostext/PluginLoader.o: vamp-sdk/Plugin.h vamp-sdk/PluginBase.h
-vamp-sdk/hostext/PluginLoader.o: vamp-sdk/RealTime.h
-vamp-sdk/hostext/PluginLoader.o: vamp-sdk/hostext/PluginLoader.h
-vamp-sdk/hostext/PluginLoader.o: vamp-sdk/hostext/PluginWrapper.h
-vamp-sdk/hostext/PluginLoader.o: vamp-sdk/hostext/PluginInputDomainAdapter.h
-vamp-sdk/hostext/PluginLoader.o: vamp-sdk/hostext/PluginChannelAdapter.h
-vamp-sdk/hostext/PluginLoader.o: vamp-sdk/hostext/PluginBufferingAdapter.h
-vamp-sdk/hostext/PluginWrapper.o: vamp-sdk/hostext/PluginWrapper.h
-vamp-sdk/hostext/PluginWrapper.o: vamp-sdk/Plugin.h vamp-sdk/PluginBase.h
-vamp-sdk/hostext/PluginWrapper.o: vamp-sdk/RealTime.h
--- a/host/vamp-simple-host.cpp	Thu Nov 06 16:55:15 2008 +0000
+++ b/host/vamp-simple-host.cpp	Fri Nov 07 14:11:39 2008 +0000
@@ -35,10 +35,9 @@
     authorization.
 */
 
-#include "vamp-sdk/PluginHostAdapter.h"
-#include "vamp-sdk/hostext/PluginInputDomainAdapter.h"
-#include "vamp-sdk/hostext/PluginLoader.h"
-#include "vamp/vamp.h"
+#include <vamp-hostsdk/PluginHostAdapter.h>
+#include <vamp-hostsdk/hostext/PluginInputDomainAdapter.h>
+#include <vamp-hostsdk/hostext/PluginLoader.h>
 
 #include <iostream>
 #include <fstream>
--- a/src/vamp-hostsdk/PluginHostAdapter.cpp	Thu Nov 06 16:55:15 2008 +0000
+++ b/src/vamp-hostsdk/PluginHostAdapter.cpp	Fri Nov 07 14:11:39 2008 +0000
@@ -34,7 +34,7 @@
     authorization.
 */
 
-#include "PluginHostAdapter.h"
+#include <vamp-hostsdk/PluginHostAdapter.h>
 #include <cstdlib>
 
 namespace Vamp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/vamp-hostsdk/RealTime.cpp	Fri Nov 07 14:11:39 2008 +0000
@@ -0,0 +1,38 @@
+/* -*- 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.
+*/
+
+#define _VAMP_IN_HOSTSDK
+#include "../vamp-sdk/RealTime.cpp"
--- a/src/vamp-hostsdk/hostext/PluginBufferingAdapter.cpp	Thu Nov 06 16:55:15 2008 +0000
+++ b/src/vamp-hostsdk/hostext/PluginBufferingAdapter.cpp	Fri Nov 07 14:11:39 2008 +0000
@@ -38,7 +38,7 @@
 #include <vector>
 #include <map>
 
-#include "PluginBufferingAdapter.h"
+#include <vamp-hostsdk/hostext/PluginBufferingAdapter.h>
 
 using std::vector;
 using std::map;
--- a/src/vamp-hostsdk/hostext/PluginChannelAdapter.cpp	Thu Nov 06 16:55:15 2008 +0000
+++ b/src/vamp-hostsdk/hostext/PluginChannelAdapter.cpp	Fri Nov 07 14:11:39 2008 +0000
@@ -34,7 +34,7 @@
     authorization.
 */
 
-#include "PluginChannelAdapter.h"
+#include <vamp-hostsdk/hostext/PluginChannelAdapter.h>
 
 namespace Vamp {
 
--- a/src/vamp-hostsdk/hostext/PluginInputDomainAdapter.cpp	Thu Nov 06 16:55:15 2008 +0000
+++ b/src/vamp-hostsdk/hostext/PluginInputDomainAdapter.cpp	Fri Nov 07 14:11:39 2008 +0000
@@ -37,7 +37,7 @@
     authorization.
 */
 
-#include "PluginInputDomainAdapter.h"
+#include <vamp-hostsdk/hostext/PluginInputDomainAdapter.h>
 
 #include <cmath>
 
--- a/src/vamp-hostsdk/hostext/PluginLoader.cpp	Thu Nov 06 16:55:15 2008 +0000
+++ b/src/vamp-hostsdk/hostext/PluginLoader.cpp	Fri Nov 07 14:11:39 2008 +0000
@@ -34,11 +34,11 @@
     authorization.
 */
 
-#include "vamp-sdk/PluginHostAdapter.h"
-#include "PluginLoader.h"
-#include "PluginInputDomainAdapter.h"
-#include "PluginChannelAdapter.h"
-#include "PluginBufferingAdapter.h"
+#include <vamp-hostsdk/PluginHostAdapter.h>
+#include <vamp-hostsdk/hostext/PluginLoader.h>
+#include <vamp-hostsdk/hostext/PluginInputDomainAdapter.h>
+#include <vamp-hostsdk/hostext/PluginChannelAdapter.h>
+#include <vamp-hostsdk/hostext/PluginBufferingAdapter.h>
 
 #include <fstream>
 #include <cctype> // tolower
--- a/src/vamp-hostsdk/hostext/PluginSummarisingAdapter.cpp	Thu Nov 06 16:55:15 2008 +0000
+++ b/src/vamp-hostsdk/hostext/PluginSummarisingAdapter.cpp	Fri Nov 07 14:11:39 2008 +0000
@@ -34,7 +34,7 @@
     authorization.
 */
 
-#include "PluginSummarisingAdapter.h"
+#include <vamp-hostsdk/hostext/PluginSummarisingAdapter.h>
 
 #include <map>
 #include <algorithm>
--- a/src/vamp-hostsdk/hostext/PluginWrapper.cpp	Thu Nov 06 16:55:15 2008 +0000
+++ b/src/vamp-hostsdk/hostext/PluginWrapper.cpp	Fri Nov 07 14:11:39 2008 +0000
@@ -34,7 +34,7 @@
     authorization.
 */
 
-#include "PluginWrapper.h"
+#include <vamp-hostsdk/hostext/PluginWrapper.h>
 
 namespace Vamp {
 
--- a/src/vamp-sdk/PluginAdapter.cpp	Thu Nov 06 16:55:15 2008 +0000
+++ b/src/vamp-sdk/PluginAdapter.cpp	Fri Nov 07 14:11:39 2008 +0000
@@ -34,13 +34,15 @@
     authorization.
 */
 
-#include "PluginAdapter.h"
+#include <vamp-sdk/PluginAdapter.h>
 
 #include <cstring>
 #include <cstdlib>
 
 //#define DEBUG_PLUGIN_ADAPTER 1
 
+namespace _VampPlugin {
+
 namespace Vamp {
 
 class PluginAdapterBase::Impl
@@ -871,3 +873,5 @@
 
 }
 
+}
+
--- a/src/vamp-sdk/RealTime.cpp	Thu Nov 06 16:55:15 2008 +0000
+++ b/src/vamp-sdk/RealTime.cpp	Fri Nov 07 14:11:39 2008 +0000
@@ -53,12 +53,16 @@
 using std::cerr;
 using std::endl;
 
-#include "RealTime.h"
-
 #ifndef _WIN32
 #include <sys/time.h>
 #endif
 
+#include <vamp-sdk/RealTime.h>
+
+#ifdef _VAMP_IN_PLUGINSDK
+namespace _VampPlugin {
+#endif
+
 namespace Vamp {
 
 // A RealTime consists of two ints that must be at least 32 bits each.
@@ -243,3 +247,9 @@
 const RealTime RealTime::zeroTime(0,0);
 
 }
+
+#ifdef _VAMP_IN_PLUGINSDK
+}
+#endif
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vamp-hostsdk/Plugin.h	Fri Nov 07 14:11:39 2008 +0000
@@ -0,0 +1,46 @@
+/* -*- 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_HOSTSDK_PLUGIN_H_
+#define _VAMP_HOSTSDK_PLUGIN_H_
+
+// Do not include vamp-sdk/Plugin.h directly from host code.  Always
+// use this header instead.
+
+#include "hostguard.h"
+#include <vamp-sdk/Plugin.h>
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vamp-hostsdk/PluginBase.h	Fri Nov 07 14:11:39 2008 +0000
@@ -0,0 +1,46 @@
+/* -*- 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_HOSTSDK_PLUGIN_BASE_H_
+#define _VAMP_HOSTSDK_PLUGIN_BASE_H_
+
+// Do not include vamp-sdk/PluginBase.h directly from host code.
+// Always use this header instead.
+
+#include "hostguard.h"
+#include <vamp-sdk/PluginBase.h>
+
+#endif
--- a/vamp-hostsdk/PluginHostAdapter.h	Thu Nov 06 16:55:15 2008 +0000
+++ b/vamp-hostsdk/PluginHostAdapter.h	Fri Nov 07 14:11:39 2008 +0000
@@ -38,7 +38,7 @@
 #define _VAMP_PLUGIN_HOST_ADAPTER_H_
 
 #include <vamp/vamp.h>
-#include <vamp-sdk/Plugin.h>
+#include "Plugin.h"
 
 #include <vector>
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vamp-hostsdk/RealTime.h	Fri Nov 07 14:11:39 2008 +0000
@@ -0,0 +1,46 @@
+/* -*- 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_HOSTSDK_REALTIME_H_
+#define _VAMP_HOSTSDK_REALTIME_H_
+
+// Do not include vamp-sdk/RealTime.h directly from host code.  Always
+// use this header instead.
+
+#include "hostguard.h"
+#include <vamp-sdk/RealTime.h>
+
+#endif
--- a/vamp-hostsdk/hostext/PluginWrapper.h	Thu Nov 06 16:55:15 2008 +0000
+++ b/vamp-hostsdk/hostext/PluginWrapper.h	Fri Nov 07 14:11:39 2008 +0000
@@ -37,7 +37,7 @@
 #ifndef _VAMP_PLUGIN_WRAPPER_H_
 #define _VAMP_PLUGIN_WRAPPER_H_
 
-#include "vamp-sdk/Plugin.h"
+#include <vamp-hostsdk/Plugin.h>
 
 namespace Vamp {
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vamp-hostsdk/hostguard.h	Fri Nov 07 14:11:39 2008 +0000
@@ -0,0 +1,47 @@
+/* -*- 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_HOSTSDK_GUARDS_H_
+#define _VAMP_HOSTSDK_GUARDS_H_
+
+#ifdef _VAMP_IN_PLUGINSDK
+#error You have included headers from both vamp-sdk and vamp-hostsdk in the same source file. Please include only vamp-sdk headers in plugin code, and only vamp-hostsdk headers in host code.
+#else
+#define _VAMP_IN_HOSTSDK
+#endif
+
+#endif
+
--- a/vamp-sdk/Plugin.h	Thu Nov 06 16:55:15 2008 +0000
+++ b/vamp-sdk/Plugin.h	Fri Nov 07 14:11:39 2008 +0000
@@ -34,15 +34,18 @@
     authorization.
 */
 
-#ifndef _VAMP_PLUGIN_H_
-#define _VAMP_PLUGIN_H_
+#ifndef _VAMP_SDK_PLUGIN_H_
+#define _VAMP_SDK_PLUGIN_H_
+
+#include <string>
+#include <vector>
+#include <map>
 
 #include "PluginBase.h"
 #include "RealTime.h"
 
-#include <string>
-#include <vector>
-#include <map>
+#include "plugguard.h"
+_VAMP_SDK_HEADER_BEGIN(Plugin.h)
 
 namespace Vamp {
 
@@ -430,6 +433,8 @@
 
 }
 
+_VAMP_SDK_HEADER_END(Plugin.h)
+
 #endif
 
 
--- a/vamp-sdk/PluginAdapter.h	Thu Nov 06 16:55:15 2008 +0000
+++ b/vamp-sdk/PluginAdapter.h	Fri Nov 07 14:11:39 2008 +0000
@@ -37,11 +37,13 @@
 #ifndef _VAMP_PLUGIN_ADAPTER_H_
 #define _VAMP_PLUGIN_ADAPTER_H_
 
+#include <map>
 #include <vamp/vamp.h>
 
 #include "Plugin.h"
 
-#include <map>
+#include "plugguard.h"
+_VAMP_SDK_HEADER_BEGIN(PluginAdapter.h)
 
 namespace Vamp {
 
@@ -113,5 +115,7 @@
     
 }
 
+_VAMP_SDK_HEADER_END(PluginAdapter.h)
+
 #endif
 
--- a/vamp-sdk/PluginBase.h	Thu Nov 06 16:55:15 2008 +0000
+++ b/vamp-sdk/PluginBase.h	Fri Nov 07 14:11:39 2008 +0000
@@ -34,13 +34,14 @@
     authorization.
 */
 
-#ifndef _VAMP_PLUGIN_BASE_H_
-#define _VAMP_PLUGIN_BASE_H_
+#ifndef _VAMP_SDK_PLUGIN_BASE_H_
+#define _VAMP_SDK_PLUGIN_BASE_H_
 
 #include <string>
 #include <vector>
 
-#define VAMP_SDK_VERSION "1.2"
+#include "plugguard.h"
+_VAMP_SDK_HEADER_BEGIN(PluginBase.h)
 
 namespace Vamp {
 
@@ -252,4 +253,6 @@
 
 }
 
+_VAMP_SDK_HEADER_END(PluginBase.h)
+
 #endif
--- a/vamp-sdk/RealTime.h	Thu Nov 06 16:55:15 2008 +0000
+++ b/vamp-sdk/RealTime.h	Fri Nov 07 14:11:39 2008 +0000
@@ -51,6 +51,9 @@
 struct timeval;
 #endif
 
+#include "plugguard.h"
+_VAMP_SDK_HEADER_BEGIN(RealTime.h)
+
 namespace Vamp {
 
 /**
@@ -158,5 +161,7 @@
 std::ostream &operator<<(std::ostream &out, const RealTime &rt);
 
 }
+
+_VAMP_SDK_HEADER_END(RealTime.h)
     
 #endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vamp-sdk/plugguard.h	Fri Nov 07 14:11:39 2008 +0000
@@ -0,0 +1,93 @@
+/* -*- 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_GUARDS_H_
+#define _VAMP_SDK_GUARDS_H_
+
+#define VAMP_SDK_VERSION "2.0"
+#define VAMP_SDK_MAJOR_VERSION 2
+#define VAMP_SDK_MINOR_VERSION 0
+
+/**
+ * Normal usage should be:
+ *
+ * - Plugins include vamp-sdk/Plugin.h or vamp-sdk/PluginBase.h.
+ *   These files include this header, which specifies an appropriate
+ *   namespace for the plugin classes to avoid any risk of conflict
+ *   with non-plugin class implementations in the host on load.
+ *
+ * - Hosts include vamp-hostsdk/Plugin.h, vamp-hostsdk/PluginBase.h,
+ *   vamp-hostsdk/PluginHostAdapter, vamp-hostsdk/hostext/<x>.h etc.
+ *   These files include vamp-hostsdk/guards.h, which makes a note
+ *   that we are in a host.  A file such as vamp-hostsdk/Plugin.h
+ *   then simply includes vamp-sdk/Plugin.h, and this guard header
+ *   takes notice of the fact that it has been included from a host
+ *   and leaves the plugin namespace unset.
+ *
+ * Problems will occur when a host includes files directly from the
+ * vamp-sdk directory.  There are two reasons this might happen:
+ * mistake, perhaps owing to ignorance of the fact that this isn't
+ * allowed (particularly since it was the normal mechanism in v1 of
+ * the SDK); and a wish to incorporate plugin code directly into the
+ * host rather than having to load it.
+ *
+ * What if the host does include a vamp-sdk header by mistake?  We can
+ * catch it if it's included before something from vamp-hostsdk.  If
+ * it's included after something from vamp-hostsdk, it will work OK
+ * anyway.  The problem case is where nothing from vamp-hostsdk is
+ * included in the same file.
+ */
+
+#ifdef _VAMP_IN_HOSTSDK
+
+#define _VAMP_SDK_HEADER_BEGIN(h)
+#define _VAMP_SDK_HEADER_END(h)
+
+#else
+
+#define _VAMP_IN_PLUGINSDK
+
+#define _VAMP_SDK_HEADER_BEGIN(h) \
+	namespace _VampPlugin {
+
+#define _VAMP_SDK_HEADER_END(h) \
+	} \
+	using namespace _VampPlugin;
+
+#endif
+
+#endif
+