Lines Matching +full:r +full:- +full:xp

23 /* #define offsetof(str,mem) ((int)(((str *)0)->mem)) */
52 sadobject *xp; in newsadobject() local
60 /* Check arg for r/w/rw */ in newsadobject()
63 if (strcmp(mode, "r") == 0) in newsadobject()
70 imode = -1; in newsadobject()
73 "Mode should be one of 'r', 'w', 'rw' or 'control'"); in newsadobject()
108 xp = PyObject_New(sadobject, &Sadtype); in newsadobject()
109 if (xp == NULL) { in newsadobject()
113 xp->x_fd = fd; in newsadobject()
114 xp->x_icount = xp->x_ocount = 0; in newsadobject()
115 xp->x_isctl = (imode < 0); in newsadobject()
117 return xp; in newsadobject()
123 sad_dealloc(sadobject *xp) in sad_dealloc() argument
125 close(xp->x_fd); in sad_dealloc()
126 PyObject_Del(xp); in sad_dealloc()
145 count = read(self->x_fd, cp, size); in sad_read()
158 self->x_icount += count; in sad_read()
175 count = write(self->x_fd, cp, size); in sad_write()
184 self->x_ocount += count; in sad_write()
198 if (ioctl(self->x_fd, AUDIO_GETINFO, &rv->ai) < 0) { in sad_getinfo()
214 if (ioctl(self->x_fd, AUDIO_SETINFO, &arg->ai) < 0) { in sad_setinfo()
227 if (ioctl(self->x_fd, AUDIO_GETINFO, &ai) < 0) { in sad_ibufcount()
231 return PyInt_FromLong(ai.record.samples - self->x_icount); in sad_ibufcount()
239 if (ioctl(self->x_fd, AUDIO_GETINFO, &ai) < 0) { in sad_obufcount()
245 return PyInt_FromLong(self->x_ocount / (ai.play.channels * in sad_obufcount()
246 ai.play.precision / 8) - in sad_obufcount()
253 if (ioctl(self->x_fd, AUDIO_DRAIN, 0) < 0) { in sad_drain()
267 if (ioctl(self->x_fd, AUDIO_GETDEV, &ad) < 0) { in sad_getdev()
278 if (ioctl(self->x_fd, I_FLUSH, FLUSHW) < 0) { in sad_flush()
290 if (self->x_fd >= 0) { in sad_close()
291 close(self->x_fd); in sad_close()
292 self->x_fd = -1; in sad_close()
301 return PyInt_FromLong(self->x_fd); in sad_fileno()
324 sad_getattr(sadobject *xp, char *name) in sad_getattr() argument
326 if (xp->x_isctl) in sad_getattr()
328 (PyObject *)xp, name); in sad_getattr()
330 return Py_FindMethod(sad_methods, (PyObject *)xp, name); in sad_getattr()
333 /* ----------------------------------------------------------------- */
341 sads_dealloc(sadstatusobject *xp) in sads_dealloc() argument
343 PyMem_DEL(xp); in sads_dealloc()
391 sads_getattr(sadstatusobject *xp, char *name) in sads_getattr() argument
393 return PyMember_Get((char *)&xp->ai, sads_ml, name); in sads_getattr()
397 sads_setattr(sadstatusobject *xp, char *name, PyObject *v) in sads_setattr() argument
403 return -1; in sads_setattr()
405 return PyMember_Set((char *)&xp->ai, sads_ml, name, v); in sads_setattr()
408 /* ------------------------------------------------------------------- */
438 /* ------------------------------------------------------------------- */