# HG changeset patch # User fazekasgy # Date 1205267098 0 # Node ID dc88002ce6873dbb21b9d6eac9335c8aafc946f4 # Parent e20e214bdfb548de0d318fdddbec085e647f40f9 some typos corrected diff -r e20e214bdfb5 -r dc88002ce687 Example VamPy plugins/PyZeroCrossing.py --- a/Example VamPy plugins/PyZeroCrossing.py Tue Mar 11 19:47:34 2008 +0000 +++ b/Example VamPy plugins/PyZeroCrossing.py Tue Mar 11 20:24:58 2008 +0000 @@ -1,4 +1,4 @@ -'''PyZeroCrossing.py - Example plugin designed to demonstrate''' +'''PyZeroCrossing.py - Example plugin demonstrates''' '''how to call a python class using the VamPy VAMP plugin''' #from time import * @@ -38,7 +38,7 @@ def getOutputDescriptors(self): - #python dictionary + #descriptors are python dictionary output0={ 'identifier':'vampy-counts', 'name':'Number of Zero Crossings', @@ -119,7 +119,7 @@ if crossing == True : count = count + 1 feature1={ - 'hasTimestamp':True, #bool + 'hasTimestamp':True, #for now return sample position and convert to RealTime in C code 'timeStamp':x #'values':[count] @@ -135,7 +135,7 @@ feature0={ 'hasTimestamp':False, - 'values':[count], #strictly must be a list + 'values':[count], #strictly must be a list 'label':str(count) } output0.append(feature0) diff -r e20e214bdfb5 -r dc88002ce687 README --- a/README Tue Mar 11 19:47:34 2008 +0000 +++ b/README Tue Mar 11 20:24:58 2008 +0000 @@ -46,6 +46,7 @@ COMPILING AND LINKING: + (1) include Python.h wherever it is on your machine (2) this plugin needs to be linked against the Python binary: @@ -53,8 +54,6 @@ g++ -O2 -Wall -I. -fPIC -c -o pyvamp-main.o pyvamp-main.cpp g++ -dynamiclib -o vamp-pyvamp-plugin.dylib ./PyPlugScanner.o ./PyPlugin.o ./pyvamp-main.o sdk/vamp-sdk/libvamp-sdk.a -u _PyMac_Error /Library/Frameworks/Python.framework/Versions/2.5/Python - - OR: (3) There is a modified Makefile from the VAMP-SDK that compiles this plugin by default. diff -r e20e214bdfb5 -r dc88002ce687 pyvamp-main.cpp --- a/pyvamp-main.cpp Tue Mar 11 19:47:34 2008 +0000 +++ b/pyvamp-main.cpp Tue Mar 11 20:24:58 2008 +0000 @@ -38,22 +38,6 @@ * This VAMP plugin is a wrapper for Python Scripts. (VamPy) * Centre for Digital Music, Queen Mary, University of London. * Copyright 2008, George Fazekas. - -TODO: needs more complete error checking - needs correct implementation of Python threading - more efficient data conversion using the buffering interface or ctypes - VAMP 'programs' not implemented - support multiple plugins per script in scanner - ensure proper cleanup, (host do a good job though) - -COMPILING AND LINKING: - (1) include Python.h wherever it is on your machine - (2) this plugin needs to be linked against the Python binary: - - example on on MacOSX: - g++ -O2 -Wall -I. -fPIC -c -o pyvamp-main.o pyvamp-main.cpp - g++ -dynamiclib -o vamp-pyvamp-plugin.dylib ./PyPlugScanner.o ./PyPlugin.o ./pyvamp-main.o sdk/vamp-sdk/libvamp-sdk.a - ... -u _PyMac_Error /Library/Frameworks/Python.framework/Versions/2.5/Python */ //#include "Python.h" @@ -141,15 +125,14 @@ void *pylib = 0; cerr << "Loading Python Interpreter at: " << pythonPath << endl; - //Preloading the binary allows the load of shared libs //dlopen("/Library/Frameworks/Python.framework/Versions/2.5/Python", RTLD_NOW|RTLD_GLOBAL); -#ifdef _WIN32 + //Preloading the binary allows the load of shared libs //TODO: check how to do RTLD_NOW on Windows pylib = LoadLibrary(pythonPath.c_str()); #else pylib = dlopen(pythonPath.c_str(), RTLD_NOW|RTLD_GLOBAL); #endif if (!pylib) cerr << "Warning: Could not preload Python." - << " Dynamic lodading in scripts will fail." << endl; + << " Dynamic loading in scripts will fail." << endl; Py_Initialize(); PyEval_InitThreads(); } else {