Changeset 5652a8c for python/ext


Ignore:
Timestamp:
Apr 19, 2016, 2:16:39 AM (9 years ago)
Author:
Paul Brossier <piem@piem.org>
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:
26eb6d0
Parents:
f50dea4
Message:

ext/: no more hell, use plain c

Location:
python/ext
Files:
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • python/ext/py-fft.c

    rf50dea4 r5652a8c  
    1 #include "aubiowraphell.h"
     1#include "aubio-types.h"
    22
    33static char Py_fft_doc[] = "fft object";
     
    1212} Py_fft;
    1313
    14 //AUBIO_NEW(fft)
    1514static PyObject *
    1615Py_fft_new (PyTypeObject * type, PyObject * args, PyObject * kwds)
     
    9089}
    9190
    92 AUBIO_MEMBERS_START(fft)
     91static PyMemberDef Py_fft_members[] = {
    9392  {"win_s", T_INT, offsetof (Py_fft, win_s), READONLY,
    9493    "size of the window"},
    95 AUBIO_MEMBERS_STOP(fft)
     94  {NULL}
     95};
    9696
    9797static PyObject *
     
    122122};
    123123
    124 AUBIO_TYPEOBJECT(fft, "aubio.fft")
     124PyTypeObject Py_fftType = {
     125  PyVarObject_HEAD_INIT (NULL, 0)
     126  "aubio.fft",
     127  sizeof (Py_fft),
     128  0,
     129  (destructor) Py_fft_del,
     130  0,
     131  0,
     132  0,
     133  0,
     134  0,
     135  0,
     136  0,
     137  0,
     138  0,
     139  (ternaryfunc)Py_fft_do,
     140  0,
     141  0,
     142  0,
     143  0,
     144  Py_TPFLAGS_DEFAULT,
     145  Py_fft_doc,
     146  0,
     147  0,
     148  0,
     149  0,
     150  0,
     151  0,
     152  Py_fft_methods,
     153  Py_fft_members,
     154  0,
     155  0,
     156  0,
     157  0,
     158  0,
     159  0,
     160  (initproc) Py_fft_init,
     161  0,
     162  Py_fft_new,
     163};
  • python/ext/py-filterbank.c

    rf50dea4 r5652a8c  
    1 #include "aubiowraphell.h"
     1#include "aubio-types.h"
    22
    33static char Py_filterbank_doc[] = "filterbank object";
     
    1212} Py_filterbank;
    1313
    14 //AUBIO_NEW(filterbank)
    1514static PyObject *
    1615Py_filterbank_new (PyTypeObject * type, PyObject * args, PyObject * kwds)
     
    9796}
    9897
    99 AUBIO_MEMBERS_START(filterbank)
     98static PyMemberDef Py_filterbank_members[] = {
    10099  {"win_s", T_INT, offsetof (Py_filterbank, win_s), READONLY,
    101100    "size of the window"},
    102101  {"n_filters", T_INT, offsetof (Py_filterbank, n_filters), READONLY,
    103102    "number of filters"},
    104 AUBIO_MEMBERS_STOP(filterbank)
     103  {NULL} /* sentinel */
     104};
    105105
    106106static PyObject *
     
    204204};
    205205
    206 AUBIO_TYPEOBJECT(filterbank, "aubio.filterbank")
     206PyTypeObject Py_filterbankType = {
     207  PyVarObject_HEAD_INIT (NULL, 0)
     208  "aubio.filterbank",
     209  sizeof (Py_filterbank),
     210  0,
     211  (destructor) Py_filterbank_del,
     212  0,
     213  0,
     214  0,
     215  0,
     216  0,
     217  0,
     218  0,
     219  0,
     220  0,
     221  (ternaryfunc)Py_filterbank_do,
     222  0,
     223  0,
     224  0,
     225  0,
     226  Py_TPFLAGS_DEFAULT,
     227  Py_filterbank_doc,
     228  0,
     229  0,
     230  0,
     231  0,
     232  0,
     233  0,
     234  Py_filterbank_methods,
     235  Py_filterbank_members,
     236  0,
     237  0,
     238  0,
     239  0,
     240  0,
     241  0,
     242  (initproc) Py_filterbank_init,
     243  0,
     244  Py_filterbank_new,
     245};
  • python/ext/py-phasevoc.c

    rf50dea4 r5652a8c  
    1 #include "aubiowraphell.h"
     1#include "aubio-types.h"
    22
    33static char Py_pvoc_doc[] = "pvoc object";
     
    1414
    1515
    16 //AUBIO_NEW(pvoc)
    1716static PyObject *
    1817Py_pvoc_new (PyTypeObject * type, PyObject * args, PyObject * kwds)
     
    5655  }
    5756
     57  return (PyObject *) self;
     58}
     59
     60static int
     61Py_pvoc_init (Py_pvoc * self, PyObject * args, PyObject * kwds)
     62{
     63  self->o = new_aubio_pvoc ( self->win_s, self->hop_s);
     64  if (self->o == NULL) {
     65    char_t errstr[30];
     66    sprintf(errstr, "error creating pvoc with %d, %d", self->win_s, self->hop_s);
     67    PyErr_SetString (PyExc_RuntimeError, errstr);
     68    return -1;
     69  }
     70
    5871  self->output = new_cvec(self->win_s);
    5972  self->routput = new_fvec(self->hop_s);
    6073
    61   return (PyObject *) self;
     74  return 0;
    6275}
    6376
    64 
    65 AUBIO_INIT(pvoc, self->win_s, self->hop_s)
    6677
    6778static void
     
    96107}
    97108
    98 AUBIO_MEMBERS_START(pvoc)
     109static PyMemberDef Py_pvoc_members[] = {
    99110  {"win_s", T_INT, offsetof (Py_pvoc, win_s), READONLY,
    100111    "size of the window"},
    101112  {"hop_s", T_INT, offsetof (Py_pvoc, hop_s), READONLY,
    102113    "size of the hop"},
    103 AUBIO_MEMBERS_STOP(pvoc)
     114  { NULL } // sentinel
     115};
    104116
    105117static PyObject *
     
    129141};
    130142
    131 AUBIO_TYPEOBJECT(pvoc, "aubio.pvoc")
     143PyTypeObject Py_pvocType = {
     144  PyVarObject_HEAD_INIT (NULL, 0)
     145  "aubio.pvoc",
     146  sizeof (Py_pvoc),
     147  0,
     148  (destructor) Py_pvoc_del,
     149  0,
     150  0,
     151  0,
     152  0,
     153  0,
     154  0,
     155  0,
     156  0,
     157  0,
     158  (ternaryfunc)Py_pvoc_do,
     159  0,
     160  0,
     161  0,
     162  0,
     163  Py_TPFLAGS_DEFAULT,
     164  Py_pvoc_doc,
     165  0,
     166  0,
     167  0,
     168  0,
     169  0,
     170  0,
     171  Py_pvoc_methods,
     172  Py_pvoc_members,
     173  0,
     174  0,
     175  0,
     176  0,
     177  0,
     178  0,
     179  (initproc) Py_pvoc_init,
     180  0,
     181  Py_pvoc_new,
     182};
  • python/ext/py-sink.c

    rf50dea4 r5652a8c  
    1 #include "aubiowraphell.h"
     1#include "aubio-types.h"
    22
    33typedef struct
     
    125125}
    126126
    127 AUBIO_DEL(sink)
     127static void
     128Py_sink_del (Py_sink *self, PyObject *unused)
     129{
     130  del_aubio_sink(self->o);
     131  Py_TYPE(self)->tp_free((PyObject *) self);
     132}
    128133
    129134/* function Py_sink_do */
     
    194199}
    195200
    196 AUBIO_MEMBERS_START(sink)
     201static PyMemberDef Py_sink_members[] = {
    197202  {"uri", T_STRING, offsetof (Py_sink, uri), READONLY,
    198203    "path at which the sink was created"},
     
    201206  {"channels", T_INT, offsetof (Py_sink, channels), READONLY,
    202207    "number of channels with which the sink was created"},
    203 AUBIO_MEMBERS_STOP(sink)
     208  { NULL } // sentinel
     209};
    204210
    205211static PyObject *
     
    217223};
    218224
    219 AUBIO_TYPEOBJECT(sink, "aubio.sink")
     225PyTypeObject Py_sinkType = {
     226  PyVarObject_HEAD_INIT (NULL, 0)
     227  "aubio.sink",
     228  sizeof (Py_sink),
     229  0,
     230  (destructor) Py_sink_del,
     231  0,
     232  0,
     233  0,
     234  0,
     235  0,
     236  0,
     237  0,
     238  0,
     239  0,
     240  (ternaryfunc)Py_sink_do,
     241  0,
     242  0,
     243  0,
     244  0,
     245  Py_TPFLAGS_DEFAULT,
     246  Py_sink_doc,
     247  0,
     248  0,
     249  0,
     250  0,
     251  0,
     252  0,
     253  Py_sink_methods,
     254  Py_sink_members,
     255  0,
     256  0,
     257  0,
     258  0,
     259  0,
     260  0,
     261  (initproc) Py_sink_init,
     262  0,
     263  Py_sink_new,
     264};
  • python/ext/py-source.c

    rf50dea4 r5652a8c  
    1 #include "aubiowraphell.h"
     1#include "aubio-types.h"
    22
    33typedef struct
     
    218218}
    219219
    220 AUBIO_MEMBERS_START(source)
     220static PyMemberDef Py_source_members[] = {
    221221  {"uri", T_STRING, offsetof (Py_source, uri), READONLY,
    222222    "path at which the source was created"},
     
    227227  {"hop_size", T_INT, offsetof (Py_source, hop_size), READONLY,
    228228    "number of consecutive frames that will be read at each do or do_multi call"},
    229 AUBIO_MEMBERS_STOP(source)
    230 
     229  { NULL } // sentinel
     230};
    231231
    232232static PyObject *
     
    286286};
    287287
    288 AUBIO_TYPEOBJECT(source, "aubio.source")
     288PyTypeObject Py_sourceType = {
     289  PyVarObject_HEAD_INIT (NULL, 0)
     290  "aubio.source",
     291  sizeof (Py_source),
     292  0,
     293  (destructor) Py_source_del,
     294  0,
     295  0,
     296  0,
     297  0,
     298  0,
     299  0,
     300  0,
     301  0,
     302  0,
     303  (ternaryfunc)Py_source_do,
     304  0,
     305  0,
     306  0,
     307  0,
     308  Py_TPFLAGS_DEFAULT,
     309  Py_source_doc,
     310  0,
     311  0,
     312  0,
     313  0,
     314  0,
     315  0,
     316  Py_source_methods,
     317  Py_source_members,
     318  0,
     319  0,
     320  0,
     321  0,
     322  0,
     323  0,
     324  (initproc) Py_source_init,
     325  0,
     326  Py_source_new,
     327};
Note: See TracChangeset for help on using the changeset viewer.