Ignore:
Timestamp:
Jun 22, 2016, 1:00:10 PM (8 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:
4b9443c4
Parents:
60fc05b (diff), 6769586 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into notes

File:
1 edited

Legend:

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

    r60fc05b rf264b17  
    1 #include "aubiowraphell.h"
     1#include "aubio-types.h"
    22
    33typedef struct
     
    88  uint_t samplerate;
    99  uint_t channels;
     10  fvec_t write_data;
     11  fmat_t mwrite_data;
    1012} Py_sink;
    1113
     
    116118  }
    117119  if (self->o == NULL) {
    118     PyErr_SetString (PyExc_StandardError, "error creating sink with this uri");
     120    PyErr_SetString (PyExc_RuntimeError, "error creating sink with this uri");
    119121    return -1;
    120122  }
     
    125127}
    126128
    127 AUBIO_DEL(sink)
     129static void
     130Py_sink_del (Py_sink *self, PyObject *unused)
     131{
     132  del_aubio_sink(self->o);
     133  free(self->mwrite_data.data);
     134  Py_TYPE(self)->tp_free((PyObject *) self);
     135}
    128136
    129137/* function Py_sink_do */
     
    135143
    136144  /* input vectors prototypes */
    137   fvec_t* write_data;
    138145  uint_t write;
    139146
     
    143150  }
    144151
    145 
    146152  /* input vectors parsing */
    147   write_data = PyAubio_ArrayToCFvec (write_data_obj);
    148 
    149   if (write_data == NULL) {
    150     return NULL;
    151   }
    152 
    153 
    154 
     153  if (!PyAubio_ArrayToCFvec(write_data_obj, &(self->write_data))) {
     154    return NULL;
     155  }
    155156
    156157
    157158  /* compute _do function */
    158   aubio_sink_do (self->o, write_data, write);
     159  aubio_sink_do (self->o, &(self->write_data), write);
    159160
    160161  Py_RETURN_NONE;
     
    169170
    170171  /* input vectors prototypes */
    171   fmat_t * write_data;
    172172  uint_t write;
    173173
     
    179179
    180180  /* input vectors parsing */
    181   write_data = PyAubio_ArrayToCFmat (write_data_obj);
    182 
    183   if (write_data == NULL) {
    184     return NULL;
    185   }
    186 
    187 
    188 
    189 
     181  if (!PyAubio_ArrayToCFmat(write_data_obj, &(self->mwrite_data))) {
     182    return NULL;
     183  }
    190184
    191185  /* compute _do function */
    192   aubio_sink_do_multi (self->o, write_data, write);
     186  aubio_sink_do_multi (self->o, &(self->mwrite_data), write);
    193187  Py_RETURN_NONE;
    194188}
    195189
    196 AUBIO_MEMBERS_START(sink)
     190static PyMemberDef Py_sink_members[] = {
    197191  {"uri", T_STRING, offsetof (Py_sink, uri), READONLY,
    198192    "path at which the sink was created"},
     
    201195  {"channels", T_INT, offsetof (Py_sink, channels), READONLY,
    202196    "number of channels with which the sink was created"},
    203 AUBIO_MEMBERS_STOP(sink)
     197  { NULL } // sentinel
     198};
    204199
    205200static PyObject *
     
    217212};
    218213
    219 AUBIO_TYPEOBJECT(sink, "aubio.sink")
     214PyTypeObject Py_sinkType = {
     215  PyVarObject_HEAD_INIT (NULL, 0)
     216  "aubio.sink",
     217  sizeof (Py_sink),
     218  0,
     219  (destructor) Py_sink_del,
     220  0,
     221  0,
     222  0,
     223  0,
     224  0,
     225  0,
     226  0,
     227  0,
     228  0,
     229  (ternaryfunc)Py_sink_do,
     230  0,
     231  0,
     232  0,
     233  0,
     234  Py_TPFLAGS_DEFAULT,
     235  Py_sink_doc,
     236  0,
     237  0,
     238  0,
     239  0,
     240  0,
     241  0,
     242  Py_sink_methods,
     243  Py_sink_members,
     244  0,
     245  0,
     246  0,
     247  0,
     248  0,
     249  0,
     250  (initproc) Py_sink_init,
     251  0,
     252  Py_sink_new,
     253  0,
     254  0,
     255  0,
     256  0,
     257  0,
     258  0,
     259  0,
     260  0,
     261  0,
     262};
Note: See TracChangeset for help on using the changeset viewer.