[PD-cvs] pd/src s_midi_oss.c,1.3.8.2.2.2,1.3.8.2.2.3

Mathieu Bouchard matju at users.sourceforge.net
Sat Aug 4 02:44:52 CEST 2007


Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17753

Modified Files:
      Tag: desiredata
	s_midi_oss.c 
Log Message:
remove stderr


Index: s_midi_oss.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_midi_oss.c,v
retrieving revision 1.3.8.2.2.2
retrieving revision 1.3.8.2.2.3
diff -C2 -d -r1.3.8.2.2.2 -r1.3.8.2.2.3
*** s_midi_oss.c	3 Aug 2007 00:06:51 -0000	1.3.8.2.2.2
--- s_midi_oss.c	4 Aug 2007 00:44:50 -0000	1.3.8.2.2.3
***************
*** 40,78 ****
          /* try to open the device for read/write. */
          if (devno == 0 && fd < 0 && outdevindex >= 0) {
!             sys_setalarm(1000000);
!             fd = open("/dev/midi", O_RDWR | O_MIDIFLAG);
!             if (sys_verbose) fprintf(stderr, "device 1: tried /dev/midi READ/WRITE; returned %d\n", fd);
              if (outdevindex >= 0 && fd >= 0) oss_midioutfd[outdevindex] = fd;
          }
          if (fd < 0 && outdevindex >= 0) {
-             sys_setalarm(1000000);
              sprintf(namebuf, "/dev/midi%2.2d", devno);
!             fd = open(namebuf, O_RDWR | O_MIDIFLAG);
!             if (sys_verbose) fprintf(stderr, "device %d: tried %s READ/WRITE; returned %d\n", devno, namebuf, fd);
              if (outdevindex >= 0 && fd >= 0) oss_midioutfd[outdevindex] = fd;
          }
          if (fd < 0 && outdevindex >= 0) {
-             sys_setalarm(1000000);
              sprintf(namebuf, "/dev/midi%d", devno);
!             fd = open(namebuf, O_RDWR | O_MIDIFLAG);
!             if (sys_verbose) fprintf(stderr, "device %d: tried %s READ/WRITE; returned %d\n", devno, namebuf, fd);
              if (outdevindex >= 0 && fd >= 0) oss_midioutfd[outdevindex] = fd;
          }
          if (devno == 1 && fd < 0) {
!             sys_setalarm(1000000);
!             fd = open("/dev/midi", O_RDONLY | O_MIDIFLAG);
!             if (sys_verbose) fprintf(stderr, "device 1: tried /dev/midi READONLY; returned %d\n", fd);
          }
          if (fd < 0) {
-             sys_setalarm(1000000);
              sprintf(namebuf, "/dev/midi%2.2d", devno);
!             fd = open(namebuf, O_RDONLY | O_MIDIFLAG);
!             if (sys_verbose) fprintf(stderr, "device %d: tried %s READONLY; returned %d\n", devno, namebuf, fd);
          }
          if (fd < 0) {
-             sys_setalarm(1000000);
              sprintf(namebuf, "/dev/midi%d", devno);
!             fd = open(namebuf, O_RDONLY | O_MIDIFLAG);
!             if (sys_verbose) fprintf(stderr, "device %d: tried %s READONLY; returned %d\n", devno, namebuf, fd);
          }
          if (fd >= 0) oss_midiinfd[oss_nmidiin++] = fd;
--- 40,72 ----
          /* try to open the device for read/write. */
          if (devno == 0 && fd < 0 && outdevindex >= 0) {
!             sys_setalarm(1000000); fd = open("/dev/midi", O_RDWR | O_MIDIFLAG);
!             if (sys_verbose) error("device 1: tried /dev/midi READ/WRITE; returned %d", fd);
              if (outdevindex >= 0 && fd >= 0) oss_midioutfd[outdevindex] = fd;
          }
          if (fd < 0 && outdevindex >= 0) {
              sprintf(namebuf, "/dev/midi%2.2d", devno);
!             sys_setalarm(1000000); fd = open(namebuf, O_RDWR | O_MIDIFLAG);
!             if (sys_verbose) error("device %d: tried %s READ/WRITE; returned %d", devno, namebuf, fd);
              if (outdevindex >= 0 && fd >= 0) oss_midioutfd[outdevindex] = fd;
          }
          if (fd < 0 && outdevindex >= 0) {
              sprintf(namebuf, "/dev/midi%d", devno);
!             sys_setalarm(1000000); fd = open(namebuf, O_RDWR | O_MIDIFLAG);
!             if (sys_verbose) error("device %d: tried %s READ/WRITE; returned %d", devno, namebuf, fd);
              if (outdevindex >= 0 && fd >= 0) oss_midioutfd[outdevindex] = fd;
          }
          if (devno == 1 && fd < 0) {
!             sys_setalarm(1000000); fd = open("/dev/midi", O_RDONLY | O_MIDIFLAG);
!             if (sys_verbose) error("device 1: tried /dev/midi READONLY; returned %d", fd);
          }
          if (fd < 0) {
              sprintf(namebuf, "/dev/midi%2.2d", devno);
!             sys_setalarm(1000000); fd = open(namebuf, O_RDONLY | O_MIDIFLAG);
!             if (sys_verbose) error("device %d: tried %s READONLY; returned %d", devno, namebuf, fd);
          }
          if (fd < 0) {
              sprintf(namebuf, "/dev/midi%d", devno);
!             sys_setalarm(1000000); fd = open(namebuf, O_RDONLY | O_MIDIFLAG);
!             if (sys_verbose) error("device %d: tried %s READONLY; returned %d", devno, namebuf, fd);
          }
          if (fd >= 0) oss_midiinfd[oss_nmidiin++] = fd;
***************
*** 84,110 ****
          int devno = midioutvec[i];
          if (devno == 1 && fd < 0) {
!             sys_setalarm(1000000);
!             fd = open("/dev/midi", O_WRONLY | O_MIDIFLAG);
!             if (sys_verbose) fprintf(stderr, "device 1: tried /dev/midi WRITEONLY; returned %d\n", fd);
          }
          if (fd < 0) {
-             sys_setalarm(1000000);
              sprintf(namebuf, "/dev/midi%2.2d", devno);
!             fd = open(namebuf, O_WRONLY | O_MIDIFLAG);
!             if (sys_verbose) fprintf(stderr, "device %d: tried %s WRITEONLY; returned %d\n", devno, namebuf, fd);
          }
          if (fd < 0) {
-             sys_setalarm(1000000);
              sprintf(namebuf, "/dev/midi%d", devno);
!             fd = open(namebuf, O_WRONLY | O_MIDIFLAG);
!             if (sys_verbose) fprintf(stderr, "device %d: tried %s WRITEONLY; returned %d\n", devno, namebuf, fd);
          }
          if (fd >= 0) oss_midioutfd[oss_nmidiout++] = fd;
          else post("couldn't open MIDI output device %d", devno);
      }
- 
      if (oss_nmidiin < nmidiin || oss_nmidiout < nmidiout || sys_verbose)
          post("opened %d MIDI input device(s) and %d MIDI output device(s).", oss_nmidiin, oss_nmidiout);
- 
      sys_setalarm(0);
  }
--- 78,99 ----
          int devno = midioutvec[i];
          if (devno == 1 && fd < 0) {
!             sys_setalarm(1000000); fd = open("/dev/midi", O_WRONLY | O_MIDIFLAG);
!             if (sys_verbose) error("device 1: tried /dev/midi WRITEONLY; returned %d", fd);
          }
          if (fd < 0) {
              sprintf(namebuf, "/dev/midi%2.2d", devno);
!             sys_setalarm(1000000); fd = open(namebuf, O_WRONLY | O_MIDIFLAG);
!             if (sys_verbose) error("device %d: tried %s WRITEONLY; returned %d", devno, namebuf, fd);
          }
          if (fd < 0) {
              sprintf(namebuf, "/dev/midi%d", devno);
!             sys_setalarm(1000000); fd = open(namebuf, O_WRONLY | O_MIDIFLAG);
!             if (sys_verbose) error("device %d: tried %s WRITEONLY; returned %d", devno, namebuf, fd);
          }
          if (fd >= 0) oss_midioutfd[oss_nmidiout++] = fd;
          else post("couldn't open MIDI output device %d", devno);
      }
      if (oss_nmidiin < nmidiin || oss_nmidiout < nmidiout || sys_verbose)
          post("opened %d MIDI input device(s) and %d MIDI output device(s).", oss_nmidiin, oss_nmidiout);
      sys_setalarm(0);
  }
***************
*** 135,141 ****
  }
  
! #if 0   /* this is the "select" version which doesn't work with OSS driver for emu10k1 (it doesn't implement select.) */
  void sys_poll_midi() {
!     int i, throttle = 100;
      struct timeval timout;
      int did = 1, maxfd = 0;
--- 124,130 ----
  }
  
! #if 0 /* this is the "select" version which doesn't work with OSS driver for emu10k1 (it doesn't implement select.) */
  void sys_poll_midi() {
!     int throttle = 100;
      struct timeval timout;
      int did = 1, maxfd = 0;
***************
*** 149,158 ****
          FD_ZERO(&readset);
          FD_ZERO(&exceptset);
!         for (i = 0; i < oss_nmidiin; i++) {
              if (oss_midiinfd[i] > maxfd) maxfd = oss_midiinfd[i];
              FD_SET(oss_midiinfd[i], &readset);
          }
          select(maxfd+1, &readset, &writeset, &exceptset, &timout);
!         for (i = 0; i < oss_nmidiin; i++) if (FD_ISSET(oss_midiinfd[i], &readset)) {
              char c;
              int ret = read(oss_midiinfd[i], &c, 1);
--- 138,147 ----
          FD_ZERO(&readset);
          FD_ZERO(&exceptset);
!         for (int i=0; i<oss_nmidiin; i++) {
              if (oss_midiinfd[i] > maxfd) maxfd = oss_midiinfd[i];
              FD_SET(oss_midiinfd[i], &readset);
          }
          select(maxfd+1, &readset, &writeset, &exceptset, &timout);
!         for (int i=0; i<oss_nmidiin; i++) if (FD_ISSET(oss_midiinfd[i], &readset)) {
              char c;
              int ret = read(oss_midiinfd[i], &c, 1);





More information about the Pd-cvs mailing list