Changeset f1f2e7e


Ignore:
Timestamp:
Feb 26, 2017, 11:47:19 PM (3 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, sampler
Children:
6dda1c0
Parents:
cc469dd
Message:

python/ext/py-source.c: add with interface (PEP 343)

File:
1 edited

Legend:

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

    rcc469dd rf1f2e7e  
    273273}
    274274
     275static char Pyaubio_source_enter_doc[] = "";
     276static PyObject* Pyaubio_source_enter(Py_source *self, PyObject *unused) {
     277  Py_INCREF(self);
     278  return (PyObject*)self;
     279}
     280
     281static char Pyaubio_source_exit_doc[] = "";
     282static PyObject* Pyaubio_source_exit(Py_source *self, PyObject *unused) {
     283  Pyaubio_source_close(self, unused);
     284  return Pyaubio_source_close(self, unused);
     285}
     286
    275287static PyMethodDef Py_source_methods[] = {
    276288  {"get_samplerate", (PyCFunction) Pyaubio_source_get_samplerate,
     
    286298  {"seek", (PyCFunction) Pyaubio_source_seek,
    287299    METH_VARARGS, Py_source_seek_doc},
     300  {"__enter__", (PyCFunction)Pyaubio_source_enter, METH_NOARGS,
     301    Pyaubio_source_enter_doc},
     302  {"__exit__",  (PyCFunction)Pyaubio_source_exit, METH_VARARGS,
     303    Pyaubio_source_exit_doc},
    288304  {NULL} /* sentinel */
    289305};
Note: See TracChangeset for help on using the changeset viewer.