[Python-checkins] python/dist/src/Modules ossaudiodev.c,1.33,1.34

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Mon, 02 Jun 2003 07:15:37 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv8856

Modified Files:
	ossaudiodev.c 
Log Message:
Whitespace normalization; break a long line.


Index: ossaudiodev.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/ossaudiodev.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** ossaudiodev.c	2 Jun 2003 14:11:45 -0000	1.33
--- ossaudiodev.c	2 Jun 2003 14:15:34 -0000	1.34
***************
*** 10,14 ****
   * by Greg Ward <gward@python.net>, November 2002.
   * Mixer interface by Nicholas FitzRoy-Dale <wzdd@lardcave.net>, Dec 2002.
!  *              
   * (c) 2000 Peter Bosch.  All Rights Reserved.
   * (c) 2002 Gregory P. Ward.  All Rights Reserved.
--- 10,14 ----
   * by Greg Ward <gward@python.net>, November 2002.
   * Mixer interface by Nicholas FitzRoy-Dale <wzdd@lardcave.net>, Dec 2002.
!  *
   * (c) 2000 Peter Bosch.  All Rights Reserved.
   * (c) 2002 Gregory P. Ward.  All Rights Reserved.
***************
*** 162,170 ****
      int fd;
      oss_mixer_t *self;
!     
      if (!PyArg_ParseTuple(arg, "|s", &basedev)) {
          return NULL;
      }
!     
      if (basedev == NULL) {
          basedev = getenv("MIXERDEV");
--- 162,170 ----
      int fd;
      oss_mixer_t *self;
! 
      if (!PyArg_ParseTuple(arg, "|s", &basedev)) {
          return NULL;
      }
! 
      if (basedev == NULL) {
          basedev = getenv("MIXERDEV");
***************
*** 182,188 ****
          return NULL;
      }
!     
      self->fd = fd;
!     
      return self;
  }
--- 182,188 ----
          return NULL;
      }
! 
      self->fd = fd;
! 
      return self;
  }
***************
*** 341,345 ****
      return _do_ioctl_0(self->fd, args, "sync", SNDCTL_DSP_SYNC);
  }
!     
  static PyObject *
  oss_reset(oss_audio_t *self, PyObject *args)
--- 341,345 ----
      return _do_ioctl_0(self->fd, args, "sync", SNDCTL_DSP_SYNC);
  }
! 
  static PyObject *
  oss_reset(oss_audio_t *self, PyObject *args)
***************
*** 347,351 ****
      return _do_ioctl_0(self->fd, args, "reset", SNDCTL_DSP_RESET);
  }
!     
  static PyObject *
  oss_post(oss_audio_t *self, PyObject *args)
--- 347,351 ----
      return _do_ioctl_0(self->fd, args, "reset", SNDCTL_DSP_RESET);
  }
! 
  static PyObject *
  oss_post(oss_audio_t *self, PyObject *args)
***************
*** 364,368 ****
      char *cp;
      PyObject *rv;
!         
      if (!PyArg_ParseTuple(args, "i:read", &size))
          return NULL;
--- 364,368 ----
      char *cp;
      PyObject *rv;
! 
      if (!PyArg_ParseTuple(args, "i:read", &size))
          return NULL;
***************
*** 415,419 ****
      fd_set write_set_fds;
      int select_rv;
!     
      /* NB. writeall() is only useful in non-blocking mode: according to
         Guenter Geiger <geiger@xdv.org> on the linux-audio-dev list
--- 415,419 ----
      fd_set write_set_fds;
      int select_rv;
! 
      /* NB. writeall() is only useful in non-blocking mode: according to
         Guenter Geiger <geiger@xdv.org> on the linux-audio-dev list
***************
*** 423,427 ****
         indistinguishable. */
  
!     if (!PyArg_ParseTuple(args, "s#:write", &cp, &size)) 
          return NULL;
  
--- 423,427 ----
         indistinguishable. */
  
!     if (!PyArg_ParseTuple(args, "s#:write", &cp, &size))
          return NULL;
  
***************
*** 476,480 ****
  oss_fileno(oss_audio_t *self, PyObject *args)
  {
!     if (!PyArg_ParseTuple(args, ":fileno")) 
          return NULL;
      return PyInt_FromLong(self->fd);
--- 476,480 ----
  oss_fileno(oss_audio_t *self, PyObject *args)
  {
!     if (!PyArg_ParseTuple(args, ":fileno"))
          return NULL;
      return PyInt_FromLong(self->fd);
***************
*** 529,533 ****
               wanted_rate, rate);
      }
!     
      /* Construct the return value: a (fmt, channels, rate) tuple that
         tells what the audio hardware was actually set to. */
--- 529,533 ----
               wanted_rate, rate);
      }
! 
      /* Construct the return value: a (fmt, channels, rate) tuple that
         tells what the audio hardware was actually set to. */
***************
*** 547,551 ****
  
      fmt = 0;
!     if (ioctl(self->fd, SNDCTL_DSP_SETFMT, &fmt) < 0) 
          return -errno;
  
--- 547,551 ----
  
      fmt = 0;
!     if (ioctl(self->fd, SNDCTL_DSP_SETFMT, &fmt) < 0)
          return -errno;
  
***************
*** 575,579 ****
  
  
! /* bufsize returns the size of the hardware audio buffer in number 
     of samples */
  static PyObject *
--- 575,579 ----
  
  
! /* bufsize returns the size of the hardware audio buffer in number
     of samples */
  static PyObject *
***************
*** 596,600 ****
  }
  
! /* obufcount returns the number of samples that are available in the 
     hardware for playing */
  static PyObject *
--- 596,600 ----
  }
  
! /* obufcount returns the number of samples that are available in the
     hardware for playing */
  static PyObject *
***************
*** 615,619 ****
          return NULL;
      }
!     return PyInt_FromLong((ai.fragstotal * ai.fragsize - ai.bytes) / 
                            (ssize * nchannels));
  }
--- 615,619 ----
          return NULL;
      }
!     return PyInt_FromLong((ai.fragstotal * ai.fragsize - ai.bytes) /
                            (ssize * nchannels));
  }
***************
*** 649,653 ****
      if (!PyArg_ParseTuple(args, ":getptr"))
          return NULL;
!     
      if (self->mode == O_RDONLY)
          req = SNDCTL_DSP_GETIPTR;
--- 649,653 ----
      if (!PyArg_ParseTuple(args, ":getptr"))
          return NULL;
! 
      if (self->mode == O_RDONLY)
          req = SNDCTL_DSP_GETIPTR;
***************
*** 683,687 ****
  oss_mixer_fileno(oss_mixer_t *self, PyObject *args)
  {
!     if (!PyArg_ParseTuple(args, ":fileno")) 
          return NULL;
      return PyInt_FromLong(self->fd);
--- 683,687 ----
  oss_mixer_fileno(oss_mixer_t *self, PyObject *args)
  {
!     if (!PyArg_ParseTuple(args, ":fileno"))
          return NULL;
      return PyInt_FromLong(self->fd);
***************
*** 715,731 ****
  {
      int channel, volume;
!     
      /* Can't use _do_ioctl_1 because of encoded arg thingy. */
      if (!PyArg_ParseTuple(args, "i:get", &channel))
          return NULL;
!     
      if (channel < 0 || channel > SOUND_MIXER_NRDEVICES) {
          PyErr_SetString(OSSAudioError, "Invalid mixer channel specified.");
          return NULL;
      }
!     
      if (ioctl(self->fd, MIXER_READ(channel), &volume) == -1)
          return PyErr_SetFromErrno(PyExc_IOError);
!     
      return Py_BuildValue("(ii)", volume & 0xff, (volume & 0xff00) >> 8);
  }
--- 715,731 ----
  {
      int channel, volume;
! 
      /* Can't use _do_ioctl_1 because of encoded arg thingy. */
      if (!PyArg_ParseTuple(args, "i:get", &channel))
          return NULL;
! 
      if (channel < 0 || channel > SOUND_MIXER_NRDEVICES) {
          PyErr_SetString(OSSAudioError, "Invalid mixer channel specified.");
          return NULL;
      }
! 
      if (ioctl(self->fd, MIXER_READ(channel), &volume) == -1)
          return PyErr_SetFromErrno(PyExc_IOError);
! 
      return Py_BuildValue("(ii)", volume & 0xff, (volume & 0xff00) >> 8);
  }
***************
*** 735,748 ****
  {
      int channel, volume, leftVol, rightVol;
!     
      /* Can't use _do_ioctl_1 because of encoded arg thingy. */
      if (!PyArg_ParseTuple(args, "i(ii):set", &channel, &leftVol, &rightVol))
          return NULL;
!             
      if (channel < 0 || channel > SOUND_MIXER_NRDEVICES) {
          PyErr_SetString(OSSAudioError, "Invalid mixer channel specified.");
          return NULL;
      }
!     
      if (leftVol < 0 || rightVol < 0 || leftVol > 100 || rightVol > 100) {
          PyErr_SetString(OSSAudioError, "Volumes must be between 0 and 100.");
--- 735,748 ----
  {
      int channel, volume, leftVol, rightVol;
! 
      /* Can't use _do_ioctl_1 because of encoded arg thingy. */
      if (!PyArg_ParseTuple(args, "i(ii):set", &channel, &leftVol, &rightVol))
          return NULL;
! 
      if (channel < 0 || channel > SOUND_MIXER_NRDEVICES) {
          PyErr_SetString(OSSAudioError, "Invalid mixer channel specified.");
          return NULL;
      }
! 
      if (leftVol < 0 || rightVol < 0 || leftVol > 100 || rightVol > 100) {
          PyErr_SetString(OSSAudioError, "Volumes must be between 0 and 100.");
***************
*** 751,758 ****
  
      volume = (rightVol << 8) | leftVol;
!     
      if (ioctl(self->fd, MIXER_WRITE(channel), &volume) == -1)
          return PyErr_SetFromErrno(PyExc_IOError);
!    
      return Py_BuildValue("(ii)", volume & 0xff, (volume & 0xff00) >> 8);
  }
--- 751,758 ----
  
      volume = (rightVol << 8) | leftVol;
! 
      if (ioctl(self->fd, MIXER_WRITE(channel), &volume) == -1)
          return PyErr_SetFromErrno(PyExc_IOError);
! 
      return Py_BuildValue("(ii)", volume & 0xff, (volume & 0xff00) >> 8);
  }
***************
*** 810,825 ****
  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 },
  
      /* Simple ioctl wrappers */
!     { "controls",       (PyCFunction)oss_mixer_controls, METH_VARARGS }, 
      { "stereocontrols", (PyCFunction)oss_mixer_stereocontrols, METH_VARARGS},
!     { "reccontrols",    (PyCFunction)oss_mixer_reccontrols, METH_VARARGS},   
      { "get",            (PyCFunction)oss_mixer_get, METH_VARARGS },
      { "set",            (PyCFunction)oss_mixer_set, METH_VARARGS },
      { "get_recsrc",     (PyCFunction)oss_mixer_get_recsrc, METH_VARARGS },
      { "set_recsrc",     (PyCFunction)oss_mixer_set_recsrc, METH_VARARGS },
!     
      { NULL,             NULL}
  };
--- 810,825 ----
  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 },
  
      /* Simple ioctl wrappers */
!     { "controls",       (PyCFunction)oss_mixer_controls, METH_VARARGS },
      { "stereocontrols", (PyCFunction)oss_mixer_stereocontrols, METH_VARARGS},
!     { "reccontrols",    (PyCFunction)oss_mixer_reccontrols, METH_VARARGS},
      { "get",            (PyCFunction)oss_mixer_get, METH_VARARGS },
      { "set",            (PyCFunction)oss_mixer_set, METH_VARARGS },
      { "get_recsrc",     (PyCFunction)oss_mixer_get_recsrc, METH_VARARGS },
      { "set_recsrc",     (PyCFunction)oss_mixer_set_recsrc, METH_VARARGS },
! 
      { NULL,             NULL}
  };
***************
*** 914,918 ****
              return -1;
          PyList_SET_ITEM(labels, i, s);
!    
          s = PyString_FromString(control_names[i]);
          if (s == NULL)
--- 914,918 ----
              return -1;
          PyList_SET_ITEM(labels, i, s);
! 
          s = PyString_FromString(control_names[i]);
          if (s == NULL)
***************
*** 927,931 ****
  
      return 0;
! }   
  
  
--- 927,931 ----
  
      return 0;
! }
  
  
***************
*** 934,945 ****
  {
      PyObject *m;
!   
      m = Py_InitModule("ossaudiodev", ossaudiodev_methods);
  
!     OSSAudioError = PyErr_NewException("ossaudiodev.OSSAudioError", NULL, NULL);
      if (OSSAudioError) {
! 	/* Each call to PyModule_AddObject decrefs it; compensate: */
! 	Py_INCREF(OSSAudioError);
! 	Py_INCREF(OSSAudioError);
          PyModule_AddObject(m, "error", OSSAudioError);
          PyModule_AddObject(m, "OSSAudioError", OSSAudioError);
--- 934,946 ----
  {
      PyObject *m;
! 
      m = Py_InitModule("ossaudiodev", ossaudiodev_methods);
  
!     OSSAudioError = PyErr_NewException("ossaudiodev.OSSAudioError",
! 				       NULL, NULL);
      if (OSSAudioError) {
!         /* Each call to PyModule_AddObject decrefs it; compensate: */
!         Py_INCREF(OSSAudioError);
!         Py_INCREF(OSSAudioError);
          PyModule_AddObject(m, "error", OSSAudioError);
          PyModule_AddObject(m, "OSSAudioError", OSSAudioError);
***************
*** 969,973 ****
      _EXPORT_INT(m, AFMT_S16_NE);
  #endif
!         
      /* Expose the sound mixer device numbers. */
      _EXPORT_INT(m, SOUND_MIXER_NRDEVICES);
--- 970,974 ----
      _EXPORT_INT(m, AFMT_S16_NE);
  #endif
! 
      /* Expose the sound mixer device numbers. */
      _EXPORT_INT(m, SOUND_MIXER_NRDEVICES);