changeset 120:7c0c11577819

Add setup.py and Vamp SDK subrepo
author Chris Cannam
date Mon, 22 Jun 2015 16:31:44 +0100
parents 36fed61cc3ac
children c45f957ef4d9
files .hgsub .hgsubstate Makefile.inc native/vampyhost.cpp setup.py
diffstat 5 files changed, 35 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/.hgsub	Wed Jun 17 18:35:37 2015 +0100
+++ b/.hgsub	Mon Jun 22 16:31:44 2015 +0100
@@ -1,1 +1,2 @@
+vamp-plugin-sdk = https://code.soundsoftware.ac.uk/hg/vamp-plugin-sdk
 test/vamp-test-plugin = https://code.soundsoftware.ac.uk/hg/vamp-test-plugin
--- a/.hgsubstate	Wed Jun 17 18:35:37 2015 +0100
+++ b/.hgsubstate	Mon Jun 22 16:31:44 2015 +0100
@@ -1,1 +1,2 @@
 89e7c9a834d3ec05cece0ed1c4b9a8ac825775e8 test/vamp-test-plugin
+c42aeb56d8288001ff45d6f00594e5f5b1e8f3de vamp-plugin-sdk
--- a/Makefile.inc	Wed Jun 17 18:35:37 2015 +0100
+++ b/Makefile.inc	Mon Jun 22 16:31:44 2015 +0100
@@ -5,20 +5,26 @@
 CC		?= gcc
 
 SRC_DIR		:= native
+VAMP_DIR	:= vamp-plugin-sdk
 
 PLUGIN_EXT	?= $(LIBRARY_EXT)
 TESTPLUG_DIR	:= test/vamp-test-plugin
 TESTPLUG	:= $(TESTPLUG_DIR)/vamp-test-plugin$(PLUGIN_EXT)
 
 HEADERS		:= $(SRC_DIR)/PyPluginObject.h $(SRC_DIR)/PyRealTime.h $(SRC_DIR)/FloatConversion.h $(SRC_DIR)/VectorConversion.h
+
 SOURCES		:= $(SRC_DIR)/PyPluginObject.cpp $(SRC_DIR)/PyRealTime.cpp $(SRC_DIR)/VectorConversion.cpp $(SRC_DIR)/vampyhost.cpp
 
+VAMP_SOURCES	:= $(wildcard $(VAMP_DIR)/src/vamp-hostsdk/*.cpp)
+
 PY		:= $(wildcard vamp/*.py)
 TESTS		:= $(wildcard test/test_*.py)
 
-OBJECTS		:= $(SOURCES:.cpp=.o)
+OBJECTS		:= $(SOURCES:.cpp=.o) $(VAMP_SOURCES:.cpp=.o)
 OBJECTS		:= $(OBJECTS:.c=.o)
 
+CXXFLAGS	+= -I$(VAMP_DIR)
+
 default:	$(LIBRARY)
 
 all:		$(LIBRARY) .tests
@@ -35,7 +41,7 @@
 		$(CXX) -o $@ $^ $(LDFLAGS)
 
 $(TESTPLUG):	
-		$(MAKE) -C $(TESTPLUG_DIR) -f Makefile$(MAKEFILE_EXT) VAMPSDK_DIR=../../../vamp-plugin-sdk
+		$(MAKE) -C $(TESTPLUG_DIR) -f Makefile$(MAKEFILE_EXT) VAMPSDK_DIR=../$(VAMP_DIR)
  
 clean:		
 		$(MAKE) -C $(TESTPLUG_DIR) -f Makefile$(MAKEFILE_EXT) clean
--- a/native/vampyhost.cpp	Wed Jun 17 18:35:37 2015 +0100
+++ b/native/vampyhost.cpp	Mon Jun 22 16:31:44 2015 +0100
@@ -60,6 +60,10 @@
 
 #include <cmath>
 
+#if (VAMP_SDK_MAJOR_VERSION != 2 || VAMP_SDK_MINOR_VERSION < 6)
+#error "Vamp plugin SDK v2, version 2.6 or newer required"
+#endif
+
 using namespace std;
 using namespace Vamp;
 using namespace Vamp::HostExt;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/setup.py	Mon Jun 22 16:31:44 2015 +0100
@@ -0,0 +1,21 @@
+from distutils.core import setup, Extension
+
+sdkdir = 'vamp-plugin-sdk/src/vamp-hostsdk/'
+vpydir = 'native/'
+
+sdkfiles = [ 'Files', 'PluginBufferingAdapter', 'PluginChannelAdapter',
+             'PluginHostAdapter', 'PluginInputDomainAdapter', 'PluginLoader',
+             'PluginSummarisingAdapter', 'PluginWrapper', 'RealTime' ]
+vpyfiles = [ 'PyPluginObject', 'PyRealTime', 'VectorConversion', 'vampyhost' ]
+
+srcfiles = [ sdkdir + f + '.cpp' for f in sdkfiles ] + [ vpydir + f + '.cpp' for f in vpyfiles ]
+
+vampyhost = Extension('vampyhost',
+                      sources = srcfiles,
+                      include_dirs = [ 'vamp-plugin-sdk' ])
+
+setup (name = 'vamp',
+       version = '1.0',
+       description = 'This module allows Python code to load and use Vamp plugins for audio feature analysis.',
+       requires = [ 'numpy' ],
+       ext_modules = [ vampyhost ])