Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/ext/aubio-types.h

    rb0fbd88 r410a157  
    11#include <Python.h>
    22#include <structmember.h>
     3
     4#include "aubio-generated.h"
    35
    46#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
     
    2628#include "aubio.h"
    2729#else
    28 #include "aubio/aubio.h"
     30#include <aubio/aubio.h>
    2931#endif
    3032
     
    3436
    3537#if HAVE_AUBIO_DOUBLE
    36 #error "Ouch! Python interface for aubio has not been much tested yet."
     38// 64 bit precision with HAVE_AUBIO_DOUBLE=1
    3739#define AUBIO_NPY_SMPL NPY_DOUBLE
     40#define AUBIO_NPY_SMPL_STR "float64"
     41#define AUBIO_NPY_SMPL_CHR "d"
    3842#else
     43// default is 32 bit precision
    3944#define AUBIO_NPY_SMPL NPY_FLOAT
     45#define AUBIO_NPY_SMPL_STR "float32"
     46#define AUBIO_NPY_SMPL_CHR "f"
    4047#endif
    4148
    42 // special python type for cvec
    43 typedef struct
    44 {
    45   PyObject_HEAD
    46   cvec_t * o;
    47   uint_t length;
    48   uint_t channels;
    49 } Py_cvec;
     49#ifndef PATH_MAX
     50#ifdef MAX_PATH
     51#define PATH_MAX MAX_PATH
     52#else
     53#define PATH_MAX 1024
     54#endif
     55#endif
     56
     57// compat with Python < 2.6
     58#ifndef Py_TYPE
     59#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
     60#endif
     61
    5062extern PyTypeObject Py_cvecType;
    5163
     64PyObject * new_py_fvec(uint_t length);
     65PyObject * new_py_cvec(uint_t length);
     66PyObject * new_py_fmat(uint_t height, uint_t length);
     67
    5268// defined in aubio-proxy.c
     69extern int PyAubio_IsValidVector (PyObject *input);
     70
    5371extern PyObject *PyAubio_CFvecToArray (fvec_t * self);
    54 extern fvec_t *PyAubio_ArrayToCFvec (PyObject * self);
     72extern int PyAubio_ArrayToCFvec (PyObject * self, fvec_t *out);
    5573
    56 extern Py_cvec *PyAubio_CCvecToPyCvec (cvec_t * self);
    57 extern cvec_t *PyAubio_ArrayToCCvec (PyObject *input);
     74extern int PyAubio_PyCvecToCCvec (PyObject *input, cvec_t *i);
    5875
    5976extern PyObject *PyAubio_CFmatToArray (fmat_t * self);
    60 extern fmat_t *PyAubio_ArrayToCFmat (PyObject *input);
     77extern int PyAubio_ArrayToCFmat (PyObject *input, fmat_t *out);
    6178
    6279// hand written wrappers
Note: See TracChangeset for help on using the changeset viewer.