$NetBSD: patch-ah,v 1.2 2002/03/23 02:36:47 wiz Exp $

--- midisend.c.orig	Mon Feb 22 09:20:19 1999
+++ midisend.c
@@ -22,6 +22,8 @@
    dlphilp@bright.net
 */
 
+#undef USE_DLP_MIDI_OUT_CODE
+
 #ifdef LINUX
 
 #include <unistd.h>
@@ -29,8 +31,20 @@
 #include <ctype.h>
 #include <sys/ioctl.h>
 #include <fcntl.h>
-#ifdef FREE_BSD
-#  include <sys/soundcard.h>
+#ifdef BSD
+#ifdef USE_DLP_MIDI_OUT_CODE
+#include <sys/midiio.h>
+#define SEQ_MIDIPUTC			SEQOLD_MIDIPUTC
+#define SEQ_DEFINEBUF(len)		unsigned char _seqbuf[len]; int _seqbuflen = len;int _seqbufptr = 0
+#define _SEQ_ADVBUF(len)		_seqbufptr += len
+#define _SEQ_NEEDBUF(len)		if ((_seqbufptr+(len)) > _seqbuflen) seqbuf_dump()
+#define SEQ_MIDIOUT(device, byte)	{_SEQ_NEEDBUF(4);\
+					_seqbuf[_seqbufptr] = SEQ_MIDIPUTC;\
+					_seqbuf[_seqbufptr+1] = (byte);\
+					_seqbuf[_seqbufptr+2] = (device);\
+					_seqbuf[_seqbufptr+3] = 0;\
+					_SEQ_ADVBUF(4);}
+#endif
 #else
 #  include <linux/soundcard.h>
 #endif
@@ -55,7 +69,7 @@
 
 /* Older DLP code begins here */
 
-/*
+#ifdef USE_DLP_MIDI_OUT_CODE
 int MIDIoutDONE = 0;
 
 #ifdef LINUX
@@ -77,8 +91,6 @@
     _seqbufptr = 0;
 }
 
-#define _gotMIDIout (1)
-
 void send_midi_message(int status, int data1, int data2)
 {
   SEQ_MIDIOUT(DEVNUM,status);
@@ -150,10 +162,10 @@
 
 #endif
 
-*/
-
 /* End of older DLP code */
 
+#else /* ! USE_DLP_MIDI_OUT_CODE */
+
 /* Begin MIDI code from Paul Barton-Davis */
 
 int MIDIoutDONE = 0;
@@ -247,7 +259,7 @@
   {
      char devname[64];
 
-     sprintf (devname, "/dev/midi%02d", midi_out);
+     sprintf (devname, "/dev/rmidi%d", midi_out);
      printf ("opening %s as MIDI out\n", devname);
      if (MIDIoutDONE==0 && (midifd= open(devname, O_WRONLY)) < 0)
         printf("Can't open MIDI device\n");
@@ -257,6 +269,7 @@
 #endif LINUX
 
   /* End of Paul Barton-Davis code */
+#endif /* ! USE_DLP_MIDI_OUT_CODE */
 
 /* ********************************* */
 /* This section for Windows95 and NT */
