Changeset 352fd5f


Ignore:
Timestamp:
Oct 2, 2009, 11:19:48 AM (10 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, pitchshift, sampler, timestretch, yinfft+
Children:
6b1aafc
Parents:
eb7f743
Message:

python/py-fvec.c, python/aubio-types.g: define AUBIO_FLOAT, move default length and channels here, rename fvec to aubio.fvec

Location:
interfaces/python
Files:
2 edited

Legend:

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

    reb7f743 r352fd5f  
    44#include <numpy/arrayobject.h>
    55#include <aubio.h>
     6
     7#define Py_fvec_default_length   1024
     8#define Py_fvec_default_channels 1
     9
     10#ifdef HAVE_AUBIO_DOUBLE
     11#define AUBIO_FLOAT NPY_FLOAT
     12#else
     13#define AUBIO_FLOAT NPY_LONG
     14#endif
     15
     16/**
     17
     18Defining this constant to 1 will allow PyAubio_CastToFvec to convert from data
     19types different than NPY_FLOAT to and fvec, and therefore creating a copy of
     20it.
     21
     22*/
     23#define AUBIO_DO_CASTING 0
    624
    725typedef struct
     
    1230} Py_fvec;
    1331extern PyTypeObject Py_fvecType;
     32
     33extern PyObject *PyAubio_FvecToArray (Py_fvec * self);
     34
     35extern Py_fvec *PyAubio_ArrayToFvec (PyObject * self);
  • interfaces/python/py-fvec.c

    reb7f743 r352fd5f  
    1111*/
    1212
    13 #define Py_fvec_default_length   1024
    14 #define Py_fvec_default_channels 1
    15 
    1613static char Py_fvec_doc[] = "fvec object";
    1714
     
    109106}
    110107
    111 static PyObject *
    112 Py_fvec_array (Py_fvec * self)
     108PyObject *
     109PyAubio_FvecToArray (Py_fvec * self)
    113110{
    114111  PyObject *array = NULL;
     
    199196  {"dump", (PyCFunction) Py_fvec_print, METH_NOARGS,
    200197      "Dumps the contents of the vector to stdout."},
    201   {"__array__", (PyCFunction) Py_fvec_array, METH_NOARGS,
     198  {"__array__", (PyCFunction) PyAubio_FvecToArray, METH_NOARGS,
    202199      "Returns the first channel as a numpy array."},
    203200  {NULL}
     
    221218  PyObject_HEAD_INIT (NULL)
    222219  0,                            /* ob_size           */
    223   "fvec",                       /* tp_name           */
     220  "aubio.fvec",                 /* tp_name           */
    224221  sizeof (Py_fvec),             /* tp_basicsize      */
    225222  0,                            /* tp_itemsize       */
Note: See TracChangeset for help on using the changeset viewer.