Ignore:
Timestamp:
Apr 21, 2016, 9:31: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:
a7f398d
Parents:
bfe8256
Message:

ext/: use new proxy functions

File:
1 edited

Legend:

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

    rbfe8256 rb5bef11  
    88  uint_t samplerate;
    99  uint_t channels;
     10  fvec_t *write_data;
     11  fmat_t *mwrite_data;
    1012} Py_sink;
    1113
     
    122124  self->channels = aubio_sink_get_channels ( self->o );
    123125
     126  self->write_data = (fvec_t *)malloc(sizeof(fvec_t));
     127  self->mwrite_data = (fmat_t *)malloc(sizeof(fmat_t));
     128  self->mwrite_data->height = self->channels;
     129  self->mwrite_data->data = (smpl_t **)malloc(sizeof(smpl_t*) * self->channels);
    124130  return 0;
    125131}
     
    129135{
    130136  del_aubio_sink(self->o);
     137  free(self->write_data);
     138  free(self->mwrite_data->data);
     139  free(self->mwrite_data);
    131140  Py_TYPE(self)->tp_free((PyObject *) self);
    132141}
     
    140149
    141150  /* input vectors prototypes */
    142   fvec_t* write_data;
    143151  uint_t write;
    144152
     
    148156  }
    149157
    150 
    151158  /* input vectors parsing */
    152   write_data = PyAubio_ArrayToCFvec (write_data_obj);
    153 
    154   if (write_data == NULL) {
    155     return NULL;
    156   }
    157 
    158 
    159 
     159  if (!PyAubio_ArrayToCFvec(write_data_obj, self->write_data)) {
     160    return NULL;
     161  }
    160162
    161163
    162164  /* compute _do function */
    163   aubio_sink_do (self->o, write_data, write);
     165  aubio_sink_do (self->o, self->write_data, write);
    164166
    165167  Py_RETURN_NONE;
     
    174176
    175177  /* input vectors prototypes */
    176   fmat_t * write_data;
    177178  uint_t write;
    178179
     
    184185
    185186  /* input vectors parsing */
    186   write_data = PyAubio_ArrayToCFmat (write_data_obj);
    187 
    188   if (write_data == NULL) {
    189     return NULL;
    190   }
    191 
    192 
    193 
    194 
     187  if (!PyAubio_ArrayToCFmat(write_data_obj, self->mwrite_data)) {
     188    return NULL;
     189  }
    195190
    196191  /* compute _do function */
    197   aubio_sink_do_multi (self->o, write_data, write);
     192  aubio_sink_do_multi (self->o, self->mwrite_data, write);
    198193  Py_RETURN_NONE;
    199194}
Note: See TracChangeset for help on using the changeset viewer.