changeset 34:c905122f79e7 vampy2

* Fixes from OpenSolaris build
author cannam
date Wed, 23 Sep 2009 12:07:32 +0000
parents c4da8d559872
children 2ba482378038
files Makefile.cc-osol PyExtensionModule.cpp PyFeature.h PyFeatureSet.h PyOutputDescriptor.h PyParameterDescriptor.h PyPlugScanner.cpp PyRealTime.cpp PyRealTime.h PyTypeInterface.cpp PyTypeInterface.h vampy-main.cpp
diffstat 12 files changed, 63 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile.cc-osol	Wed Sep 23 12:07:32 2009 +0000
@@ -0,0 +1,39 @@
+
+CXX		:= CC
+CXXFLAGS	:= -I/usr/local/include -G -DHAVE_NUMPY -O2 +w -I/usr/include/python2.6 -I/usr/lib/python2.6/site-packages/numpy/core/include/numpy -KPIC
+LDFLAGS		:= -L/usr/local/lib -G -Bstatic -lvamp-sdk -Bdynamic -lpython2.6 -lpthread -Qoption ld -Mvamp-plugin.map
+
+default: vampy.so 
+all: vampy.so vampymod.so
+
+PyExtensionModule.a: PyExtensionModule.o PyRealTime.o PyFeature.o PyParameterDescriptor.o PyOutputDescriptor.o PyFeatureSet.o 
+	ar cr $@ $^
+
+# The standard python extension is .so (even on the Mac)
+vampymod.so: PyExtensionModule.o PyRealTime.o PyFeature.o PyParameterDescriptor.o PyOutputDescriptor.o PyFeatureSet.o 
+	$(CXX) $^ -o $@ $(LDFLAGS) 
+
+vampy.so: PyPlugin.o PyPlugScanner.o vampy-main.o Mutex.o PyTypeInterface.o PyExtensionModule.a 
+	$(CXX) $^ -o $@ $(LDFLAGS) 
+
+# Install plugin
+#
+LIBRARY_PREFIX		:=/Library
+INSTALL_DIR			:=$(LIBRARY_PREFIX)/Audio/Plug-Ins/Vamp
+PYEXAMPLE_DIR		:='Example VamPy Plugins'
+PLUGIN_NAME			:=vampy
+PLUGIN_EXT			:=.so
+
+install:
+	mkdir -p $(INSTALL_DIR)
+	rm -f $(INSTALL_DIR)/$(PLUGIN_NAME)$(PLUGIN_EXT)
+	cp $(PLUGIN_NAME)$(PLUGIN_EXT) $(INSTALL_DIR)/$(PLUGIN_NAME)$(PLUGIN_EXT)
+
+installplug : install
+cleanplug : clean
+
+clean:	
+	rm -f *.o
+	rm -f *.a
+	rm -f *$(PLUGIN_EXT)
+
--- a/PyExtensionModule.cpp	Wed Sep 23 11:56:46 2009 +0000
+++ b/PyExtensionModule.cpp	Wed Sep 23 12:07:32 2009 +0000
@@ -44,7 +44,7 @@
 	self = PyObject_New(RealTimeObject, &RealTime_Type); 
 	if (self == NULL) return NULL;
 
-	self->rt = new RealTime::RealTime(
+	self->rt = new RealTime(
 	RealTime::frame2RealTime(frame,sampleRate));
 
 	return (PyObject *) self;
--- a/PyFeature.h	Wed Sep 23 11:56:46 2009 +0000
+++ b/PyFeature.h	Wed Sep 23 12:07:32 2009 +0000
@@ -33,4 +33,4 @@
 // #define PyFeature_AS_FEATURE(v) ((const FeatureObject* const) (v))->feature
 
 
-#endif
\ No newline at end of file
+#endif
--- a/PyFeatureSet.h	Wed Sep 23 11:56:46 2009 +0000
+++ b/PyFeatureSet.h	Wed Sep 23 12:07:32 2009 +0000
@@ -17,4 +17,4 @@
 
 void initFeatureSetType(void);
 
-#endif
\ No newline at end of file
+#endif
--- a/PyOutputDescriptor.h	Wed Sep 23 11:56:46 2009 +0000
+++ b/PyOutputDescriptor.h	Wed Sep 23 12:07:32 2009 +0000
@@ -19,4 +19,4 @@
 ///fast macro version as per API convention
 #define PyOutputDescriptor_AS_DICT(v) ((const OutputDescriptorObject* const) (v))->dict
 
-#endif
\ No newline at end of file
+#endif
--- a/PyParameterDescriptor.h	Wed Sep 23 11:56:46 2009 +0000
+++ b/PyParameterDescriptor.h	Wed Sep 23 12:07:32 2009 +0000
@@ -19,4 +19,4 @@
 ///fast macro version as per API convention
 #define PyParameterDescriptor_AS_DICT(v) ((const ParameterDescriptorObject* const) (v))->dict
 
-#endif
\ No newline at end of file
+#endif
--- a/PyPlugScanner.cpp	Wed Sep 23 11:56:46 2009 +0000
+++ b/PyPlugScanner.cpp	Wed Sep 23 12:07:32 2009 +0000
@@ -179,8 +179,6 @@
     struct dirent *e = 0;
     while ((e = readdir(d))) {
  
-        if (!(e->d_type & DT_REG) && (e->d_type != DT_UNKNOWN)) continue;
-        
         if (!e->d_name) continue;
        
         size_t len = strlen(e->d_name);
--- a/PyRealTime.cpp	Wed Sep 23 11:56:46 2009 +0000
+++ b/PyRealTime.cpp	Wed Sep 23 12:07:32 2009 +0000
@@ -45,18 +45,18 @@
 	self->rt = NULL;
 
 	if (sec == 0 && nsec == 0 && fmt == 0) 
-		self->rt = new RealTime::RealTime();
+		self->rt = new RealTime();
 	else if (fmt == 0)
-		self->rt = new RealTime::RealTime(sec,nsec);
+		self->rt = new RealTime(sec,nsec);
 	else { 
         /// new RealTime from seconds or milliseconds: i.e. >>>RealTime('seconds',12.3)
 		if (!string(fmt).compare("float") ||
 			!string(fmt).compare("seconds"))  
-			self->rt = new RealTime::RealTime( 
+			self->rt = new RealTime( 
 			RealTime::fromSeconds((double) unary)); 
 
 		if (!string(fmt).compare("milliseconds")) {
-			self->rt = new RealTime::RealTime( 
+			self->rt = new RealTime( 
 			RealTime::fromSeconds((double) unary / 1000.0)); }
 	}
 
@@ -205,7 +205,7 @@
     PyObject_New(RealTimeObject, &RealTime_Type); 
 	if (result == NULL) return NULL;
 
-	result->rt = new RealTime::RealTime(
+	result->rt = new RealTime(
 	*((RealTimeObject*)s)->rt + *((RealTimeObject*)w)->rt);
 	return (PyObject*)result;
 }
@@ -217,7 +217,7 @@
     PyObject_New(RealTimeObject, &RealTime_Type); 
 	if (result == NULL) return NULL;
 
-	result->rt = new RealTime::RealTime(
+	result->rt = new RealTime(
 	*((RealTimeObject*)s)->rt - *((RealTimeObject*)w)->rt);
 	return (PyObject*)result;
 }
@@ -313,7 +313,7 @@
 	PyObject_New(RealTimeObject, &RealTime_Type); 
 	if (self == NULL) return NULL;
 
-	self->rt = new RealTime::RealTime(*rt);
+	self->rt = new RealTime(*rt);
 	return (PyObject*) self;
 }*/
 
@@ -326,12 +326,12 @@
 	PyObject_New(RealTimeObject, &RealTime_Type); 
 	if (self == NULL) return NULL;
 
-	self->rt = new RealTime::RealTime(rt);
+	self->rt = new RealTime(rt);
 	return (PyObject*) self;
 }
 
 /*RealTime* from PyRealTime*/
-const Vamp::RealTime::RealTime*
+const Vamp::RealTime*
 PyRealTime_AsRealTime (PyObject *self) { 
 
 	RealTimeObject *s = (RealTimeObject*) self; 
--- a/PyRealTime.h	Wed Sep 23 11:56:46 2009 +0000
+++ b/PyRealTime.h	Wed Sep 23 12:07:32 2009 +0000
@@ -5,7 +5,7 @@
 
 typedef struct {
 		PyObject_HEAD
-		Vamp::RealTime::RealTime *rt;
+		Vamp::RealTime *rt;
 } RealTimeObject; 
 
 PyAPI_DATA(PyTypeObject) RealTime_Type;
@@ -21,8 +21,8 @@
 PyAPI_FUNC(PyObject *) 
 PyRealTime_FromRealTime(Vamp::RealTime&);
 
-PyAPI_FUNC(const Vamp::RealTime::RealTime*) 
+PyAPI_FUNC(const Vamp::RealTime*) 
 PyRealTime_AsRealTime (PyObject *self);
 
 
-#endif
\ No newline at end of file
+#endif
--- a/PyTypeInterface.cpp	Wed Sep 23 11:56:46 2009 +0000
+++ b/PyTypeInterface.cpp	Wed Sep 23 12:07:32 2009 +0000
@@ -704,7 +704,7 @@
 	return rFeatureSet;
 }
 
-Vamp::RealTime::RealTime
+Vamp::RealTime
 PyTypeInterface::PyValue_To_RealTime(PyObject* pyValue) const
 {
 // We accept integer sample counts (for backwards compatibility)
@@ -716,7 +716,7 @@
 		cerr << "Converting from PyRealTime" << endl;
 #endif
 		/// just create a copy of the wrapped object
-		return Vamp::RealTime::RealTime(
+		return Vamp::RealTime(
 			*PyRealTime_AS_REALTIME(pyValue));
 	}
 	// assume integer sample count
@@ -725,10 +725,10 @@
 	{
 		PyErr_Print(); PyErr_Clear();
 		setValueError("Error while converting integer to RealTime.",m_strict);
-		return Vamp::RealTime::RealTime();
+		return Vamp::RealTime();
 	}
 #ifdef _DEBUG
-	Vamp::RealTime::RealTime rt = 
+	Vamp::RealTime rt = 
 		Vamp::RealTime::frame2RealTime(sampleCount,m_inputSampleRate );
 	cerr << "RealTime: " << (long)sampleCount << ", ->" << rt.toString() << endl;
 	return rt;
--- a/PyTypeInterface.h	Wed Sep 23 11:56:46 2009 +0000
+++ b/PyTypeInterface.h	Wed Sep 23 12:07:32 2009 +0000
@@ -234,8 +234,8 @@
 	inline void PyValue_To_rValue(PyObject *pyValue, Vamp::Plugin::FeatureSet &r) const
 		{ r = this->PyValue_To_FeatureSet(pyValue); }
 
-	Vamp::RealTime::RealTime PyValue_To_RealTime(PyObject*) const;
-	inline void PyValue_To_rValue(PyObject *pyValue, Vamp::RealTime::RealTime &r) const
+	Vamp::RealTime PyValue_To_RealTime(PyObject*) const;
+	inline void PyValue_To_rValue(PyObject *pyValue, Vamp::RealTime &r) const
 		{ r = this->PyValue_To_RealTime(pyValue); }
 	
 	
@@ -295,7 +295,7 @@
 		{ r = PyValue_To_StringVector(pyValue); }
 	inline void _convert(PyObject *pyValue,std::vector<float> &r) const
 		{ r = PyValue_To_FloatVector(pyValue); }
-    inline void _convert(PyObject *pyValue,Vamp::RealTime::RealTime &r) const 
+    inline void _convert(PyObject *pyValue,Vamp::RealTime &r) const 
 		{ r = PyValue_To_RealTime(pyValue); }
 	
 public:
--- a/vampy-main.cpp	Wed Sep 23 11:56:46 2009 +0000
+++ b/vampy-main.cpp	Wed Sep 23 12:07:32 2009 +0000
@@ -78,21 +78,17 @@
 
 static bool tryPreload(string name)
 {
-    cerr << "Trying to load Python interpreter library \"" << name << "\"...";
 #ifdef _WIN32
     void *lib = LoadLibrary(name.c_str());
     if (!lib) {
-        cerr << " failed" << endl;
         return false;
     }
 #else
     void *lib = dlopen(name.c_str(), RTLD_NOW | RTLD_GLOBAL);
     if (!lib) {
-        cerr << " failed" << endl;
         return false;
     }
 #endif
-    cerr << " succeeded" << endl;
     return true;
 }