Changeset ad5203c
- Timestamp:
- Mar 5, 2013, 5:46:48 PM (12 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- 63f6c13
- Parents:
- 208336b
- Files:
-
- 1 deleted
- 6 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
python/ext/aubio-types.h
r208336b rad5203c 11 11 #ifndef PY_AUBIO_MODULE_MAIN 12 12 #define NO_IMPORT_ARRAY 13 #endif 14 #include <numpy/arrayobject.h> 15 #ifndef PY_AUBIO_MODULE_UFUNC 13 16 #define NO_IMPORT_UFUNC 17 #else 18 #include <numpy/ufuncobject.h> 14 19 #endif 15 20 16 21 // import aubio 17 #include <numpy/ndarraytypes.h> 18 #include <numpy/ufuncobject.h> 19 #include <numpy/npy_3kcompat.h> 22 //#include <numpy/npy_3kcompat.h> 20 23 21 24 #define AUBIO_UNSTABLE 1 22 #include <aubio.h>25 #include "aubio.h" 23 26 24 27 #define Py_default_vector_length 1024 -
python/ext/aubiomodule.c
r208336b rad5203c 1 1 #define PY_AUBIO_MODULE_MAIN 2 2 #include "aubio-types.h" 3 #include "generated/aubio-generated.h" 3 #include "aubio-generated.h" 4 5 extern void add_generated_objects ( PyObject *m ); 6 extern void add_ufuncs ( PyObject *m ); 4 7 5 8 static char Py_alpha_norm_doc[] = "compute alpha normalisation factor"; … … 262 265 263 266 err = _import_array (); 264 265 267 if (err != 0) { 266 268 fprintf (stderr, 267 "Unable to import Numpy C APIfrom aubio module (error %d)\n", err);269 "Unable to import Numpy array from aubio module (error %d)\n", err); 268 270 } 269 271 -
python/ext/ufuncs.c
r208336b rad5203c 1 #define PY_AUBIO_MODULE_UFUNC 1 2 #include "aubio-types.h" 2 3 … … 61 62 void add_ufuncs ( PyObject *m ) 62 63 { 63 int err = _import_umath();64 int err = 0; 64 65 66 err = _import_umath (); 65 67 if (err != 0) { 66 68 fprintf (stderr, 67 "Unable to import Numpy C API Ufuncfrom aubio module (error %d)\n", err);69 "Unable to import Numpy umath from aubio module (error %d)\n", err); 68 70 } 69 71 -
python/gen_pyobject.py
r208336b rad5203c 173 173 174 174 // WARNING: if you haven't read the first line yet, please do so 175 #include " ext/aubiowraphell.h"175 #include "aubiowraphell.h" 176 176 177 177 typedef struct -
python/generator.py
r208336b rad5203c 28 28 return cpp_output, cpp_objects 29 29 30 def generate_object_files( ):31 if os.path.isdir( 'generated'): shutil.rmtree('generated')32 os.mkdir( 'generated')30 def generate_object_files(output_path): 31 if os.path.isdir(output_path): shutil.rmtree(output_path) 32 os.mkdir(output_path) 33 33 34 34 generated_objects = [] … … 49 49 for this_object in cpp_objects: 50 50 lint = 0 51 51 52 52 if this_object[-2:] == '_t': 53 53 object_name = this_object[:-2] … … 127 127 if 1: #try: 128 128 s = gen_new_init(new_methods[0], short_name) 129 s += gen_do(do_methods[0], short_name) 129 s += gen_do(do_methods[0], short_name) 130 130 s += gen_members(new_methods[0], short_name) 131 131 s += gen_methods(get_methods, set_methods, short_name) 132 132 s += gen_finish(short_name) 133 generated_filepath = 'generated/gen-'+short_name+'.c'133 generated_filepath = os.path.join(output_path,'gen-'+short_name+'.c') 134 134 fd = open(generated_filepath, 'w') 135 135 fd.write(s) … … 175 175 }""" 176 176 177 fd = open( 'generated/aubio-generated.h', 'w')177 fd = open(os.path.join(output_path,'aubio-generated.h'), 'w') 178 178 fd.write(s) 179 179 180 180 from os import listdir 181 generated_files = listdir( 'generated')181 generated_files = listdir(output_path) 182 182 generated_files = filter(lambda x: x.endswith('.c'), generated_files) 183 generated_files = [ 'generated/'+f for f in generated_files]183 generated_files = [output_path+'/'+f for f in generated_files] 184 184 return generated_files 185 185 186 186 if __name__ == '__main__': 187 generate_object_files( )187 generate_object_files('gen') -
python/setup.py
r208336b rad5203c 2 2 3 3 from distutils.core import setup, Extension 4 from generator import generate_object_files5 4 import sys 6 5 import os.path … … 8 7 9 8 # read from VERSION 10 for l in open( os.path.join('..','VERSION')).readlines(): exec (l.strip())9 for l in open('VERSION').readlines(): exec (l.strip()) 11 10 __version__ = '.'.join \ 12 11 ([str(x) for x in [AUBIO_MAJOR_VERSION, AUBIO_MINOR_VERSION, AUBIO_PATCH_VERSION]]) \ 13 12 + AUBIO_VERSION_STATUS 14 13 15 library_dirs = ['../build/src', '../src/.libs'] 16 include_dirs = ['../build/src', '../src', '.' ] 14 library_dirs = ['../build/src'] 15 include_dirs = ['../src'] # aubio.h 16 include_dirs += ['../build/src'] # config.h 17 include_dirs += ['ext'] 18 include_dirs += ['gen'] 19 #include_dirs += ['../build/src', '../src', '.' ] 20 17 21 library_dirs = filter (lambda x: os.path.isdir(x), library_dirs) 18 22 include_dirs = filter (lambda x: os.path.isdir(x), include_dirs) 23 24 generated_object_files = [] 25 26 output_path = 'gen' 27 28 if not os.path.isdir(output_path): 29 from generator import generate_object_files 30 generated_object_files = generate_object_files(output_path) 31 else: 32 import glob 33 generated_object_files = glob.glob(os.path.join(output_path, '*.c')) 19 34 20 35 aubio_extension = Extension("aubio._aubio", [ … … 30 45 "ext/py-phasevoc.c", 31 46 # generated files 32 ] + generate _object_files(),47 ] + generated_object_files, 33 48 include_dirs = include_dirs + [ numpy.get_include() ], 34 49 library_dirs = library_dirs,
Note: See TracChangeset
for help on using the changeset viewer.