Changeset 11b49d7 for python/ext


Ignore:
Timestamp:
Sep 21, 2014, 2:42:08 AM (10 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:
74dcddb
Parents:
24931d5
Message:

python/ext/py-source.c: add seek, thanks @davebrent for the heads up

File:
1 edited

Legend:

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

    r24931d5 r11b49d7  
    6969"\n"
    7070"Close this source now.";
     71
     72static char Py_source_seek_doc[] = ""
     73"x.seek(position)\n"
     74"\n"
     75"Seek to resampled frame position.";
    7176
    7277static PyObject *
     
    236241{
    237242  aubio_source_close (self->o);
     243  Py_RETURN_NONE;
     244}
     245
     246static PyObject *
     247Pyaubio_source_seek (Py_source *self, PyObject *args)
     248{
     249  uint_t err = 0;
     250
     251  uint_t position;
     252  if (!PyArg_ParseTuple (args, "I", &position)) {
     253    return NULL;
     254  }
     255
     256  err = aubio_source_seek(self->o, position);
     257  if (err != 0) {
     258    PyErr_SetString (PyExc_ValueError,
     259        "error when seeking in source");
     260    return NULL;
     261  }
    238262  Py_RETURN_NONE;
    239263}
     
    250274  {"close", (PyCFunction) Pyaubio_source_close,
    251275    METH_NOARGS, Py_source_close_doc},
     276  {"seek", (PyCFunction) Pyaubio_source_seek,
     277    METH_VARARGS, Py_source_seek_doc},
    252278  {NULL} /* sentinel */
    253279};
Note: See TracChangeset for help on using the changeset viewer.