diff options
Diffstat (limited to 'Modules/ossaudiodev.c')
-rw-r--r-- | Modules/ossaudiodev.c | 65 |
1 files changed, 20 insertions, 45 deletions
diff --git a/Modules/ossaudiodev.c b/Modules/ossaudiodev.c index 563620c..9716838 100644 --- a/Modules/ossaudiodev.c +++ b/Modules/ossaudiodev.c @@ -296,12 +296,10 @@ _do_ioctl_0(int fd, PyObject *args, char *fname, int cmd) */ static PyObject * -oss_nonblock(oss_audio_t *self, PyObject *args) +oss_nonblock(oss_audio_t *self, PyObject *unused) { /* Hmmm: it doesn't appear to be possible to return to blocking mode once we're in non-blocking mode! */ - if (!PyArg_ParseTuple(args, ":nonblock")) - return NULL; if (ioctl(self->fd, SNDCTL_DSP_NONBLOCK, NULL) == -1) return PyErr_SetFromErrno(PyExc_IOError); Py_INCREF(Py_None); @@ -315,11 +313,9 @@ oss_setfmt(oss_audio_t *self, PyObject *args) } static PyObject * -oss_getfmts(oss_audio_t *self, PyObject *args) +oss_getfmts(oss_audio_t *self, PyObject *unused) { int mask; - if (!PyArg_ParseTuple(args, ":getfmts")) - return NULL; if (ioctl(self->fd, SNDCTL_DSP_GETFMTS, &mask) == -1) return PyErr_SetFromErrno(PyExc_IOError); return PyInt_FromLong(mask); @@ -459,11 +455,8 @@ oss_writeall(oss_audio_t *self, PyObject *args) } static PyObject * -oss_close(oss_audio_t *self, PyObject *args) +oss_close(oss_audio_t *self, PyObject *unused) { - if (!PyArg_ParseTuple(args, ":close")) - return NULL; - if (self->fd >= 0) { Py_BEGIN_ALLOW_THREADS close(self->fd); @@ -475,10 +468,8 @@ oss_close(oss_audio_t *self, PyObject *args) } static PyObject * -oss_fileno(oss_audio_t *self, PyObject *args) +oss_fileno(oss_audio_t *self, PyObject *unused) { - if (!PyArg_ParseTuple(args, ":fileno")) - return NULL; return PyInt_FromLong(self->fd); } @@ -578,13 +569,11 @@ _ssize(oss_audio_t *self, int *nchannels, int *ssize) /* bufsize returns the size of the hardware audio buffer in number of samples */ static PyObject * -oss_bufsize(oss_audio_t *self, PyObject *args) +oss_bufsize(oss_audio_t *self, PyObject *unused) { audio_buf_info ai; int nchannels=0, ssize=0; - if (!PyArg_ParseTuple(args, ":bufsize")) return NULL; - if (_ssize(self, &nchannels, &ssize) < 0 || !nchannels || !ssize) { PyErr_SetFromErrno(PyExc_IOError); return NULL; @@ -599,14 +588,11 @@ oss_bufsize(oss_audio_t *self, PyObject *args) /* obufcount returns the number of samples that are available in the hardware for playing */ static PyObject * -oss_obufcount(oss_audio_t *self, PyObject *args) +oss_obufcount(oss_audio_t *self, PyObject *unused) { audio_buf_info ai; int nchannels=0, ssize=0; - if (!PyArg_ParseTuple(args, ":obufcount")) - return NULL; - if (_ssize(self, &nchannels, &ssize) < 0 || !nchannels || !ssize) { PyErr_SetFromErrno(PyExc_IOError); return NULL; @@ -622,14 +608,11 @@ oss_obufcount(oss_audio_t *self, PyObject *args) /* obufcount returns the number of samples that can be played without blocking */ static PyObject * -oss_obuffree(oss_audio_t *self, PyObject *args) +oss_obuffree(oss_audio_t *self, PyObject *unused) { audio_buf_info ai; int nchannels=0, ssize=0; - if (!PyArg_ParseTuple(args, ":obuffree")) - return NULL; - if (_ssize(self, &nchannels, &ssize) < 0 || !nchannels || !ssize) { PyErr_SetFromErrno(PyExc_IOError); return NULL; @@ -642,14 +625,11 @@ oss_obuffree(oss_audio_t *self, PyObject *args) } static PyObject * -oss_getptr(oss_audio_t *self, PyObject *args) +oss_getptr(oss_audio_t *self, PyObject *unused) { count_info info; int req; - if (!PyArg_ParseTuple(args, ":getptr")) - return NULL; - if (self->mode == O_RDONLY) req = SNDCTL_DSP_GETIPTR; else @@ -667,11 +647,8 @@ oss_getptr(oss_audio_t *self, PyObject *args) */ static PyObject * -oss_mixer_close(oss_mixer_t *self, PyObject *args) +oss_mixer_close(oss_mixer_t *self, PyObject *unused) { - if (!PyArg_ParseTuple(args, ":close")) - return NULL; - if (self->fd >= 0) { close(self->fd); self->fd = -1; @@ -681,10 +658,8 @@ oss_mixer_close(oss_mixer_t *self, PyObject *args) } static PyObject * -oss_mixer_fileno(oss_mixer_t *self, PyObject *args) +oss_mixer_fileno(oss_mixer_t *self, PyObject *unused) { - if (!PyArg_ParseTuple(args, ":fileno")) - return NULL; return PyInt_FromLong(self->fd); } @@ -782,13 +757,13 @@ static PyMethodDef oss_methods[] = { { "read", (PyCFunction)oss_read, METH_VARARGS }, { "write", (PyCFunction)oss_write, METH_VARARGS }, { "writeall", (PyCFunction)oss_writeall, METH_VARARGS }, - { "close", (PyCFunction)oss_close, METH_VARARGS }, - { "fileno", (PyCFunction)oss_fileno, METH_VARARGS }, + { "close", (PyCFunction)oss_close, METH_NOARGS }, + { "fileno", (PyCFunction)oss_fileno, METH_NOARGS }, /* Simple ioctl wrappers */ - { "nonblock", (PyCFunction)oss_nonblock, METH_VARARGS }, + { "nonblock", (PyCFunction)oss_nonblock, METH_NOARGS }, { "setfmt", (PyCFunction)oss_setfmt, METH_VARARGS }, - { "getfmts", (PyCFunction)oss_getfmts, METH_VARARGS }, + { "getfmts", (PyCFunction)oss_getfmts, METH_NOARGS }, { "channels", (PyCFunction)oss_channels, METH_VARARGS }, { "speed", (PyCFunction)oss_speed, METH_VARARGS }, { "sync", (PyCFunction)oss_sync, METH_VARARGS }, @@ -797,10 +772,10 @@ static PyMethodDef oss_methods[] = { /* Convenience methods -- wrap a couple of ioctls together */ { "setparameters", (PyCFunction)oss_setparameters, METH_VARARGS }, - { "bufsize", (PyCFunction)oss_bufsize, METH_VARARGS }, - { "obufcount", (PyCFunction)oss_obufcount, METH_VARARGS }, - { "obuffree", (PyCFunction)oss_obuffree, METH_VARARGS }, - { "getptr", (PyCFunction)oss_getptr, METH_VARARGS }, + { "bufsize", (PyCFunction)oss_bufsize, METH_NOARGS }, + { "obufcount", (PyCFunction)oss_obufcount, METH_NOARGS }, + { "obuffree", (PyCFunction)oss_obuffree, METH_NOARGS }, + { "getptr", (PyCFunction)oss_getptr, METH_NOARGS }, /* Aliases for backwards compatibility */ { "flush", (PyCFunction)oss_sync, METH_VARARGS }, @@ -810,8 +785,8 @@ static PyMethodDef oss_methods[] = { static PyMethodDef oss_mixer_methods[] = { /* Regular file method - OSS mixers are ioctl-only interface */ - { "close", (PyCFunction)oss_mixer_close, METH_VARARGS }, - { "fileno", (PyCFunction)oss_mixer_fileno, METH_VARARGS }, + { "close", (PyCFunction)oss_mixer_close, METH_NOARGS }, + { "fileno", (PyCFunction)oss_mixer_fileno, METH_NOARGS }, /* Simple ioctl wrappers */ { "controls", (PyCFunction)oss_mixer_controls, METH_VARARGS }, |