summaryrefslogtreecommitdiff
path: root/games/fkiss/patches/patch-ad
blob: 8b53174dc224bcc2a64eb4539c03cb6aca984125 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
$NetBSD: patch-ad,v 1.1.1.1 2002/07/14 09:40:30 rh Exp $

--- sound.c.orig	Mon Oct 16 22:10:55 2000
+++ sound.c
@@ -43,6 +43,13 @@
 # include <machine/soundcard.h>
 #endif
 
+#ifdef __NetBSD__
+# define USE_DSP
+# define DEV_SOUND	"/dev/sound"
+# include <sys/ioctl.h>
+# include <soundcard.h>
+#endif
+
 #ifndef DEV_SOUND
 # define DEV_SOUND	"/dev/audio"
 #endif
@@ -61,7 +68,7 @@
 
 #include "ulaw.h"
 
-
+char *midi_player = "/usr/bin/midiplay";
 char *sound_device = DEV_SOUND;
 int sound_debug = 1;		/* debug information print level
 				 * 0: print nothing, silent
@@ -218,7 +225,7 @@
 {
   if (sound_debug >= 2)
     fputs("sync", stderr);
-  ioctl(fd, SNDCTL_DSP_SYNC);
+  ioctl(fd, SNDCTL_DSP_SYNC, 0);
   if (sound_debug >= 2)
     fputs(" ", stderr);
 }
@@ -639,6 +646,17 @@
   
   if (!sound_enable)
     return 0;
+
+  bufp = name;
+  while (strstr(bufp + 1, ".mid") != NULL) bufp = strstr(bufp + 1, ".mid");
+  while (strstr(bufp + 1, ".MID") != NULL) bufp = strstr(bufp + 1, ".MID");
+  if ((!strncmp(bufp, ".mid", 4) || !strncmp(bufp, ".MID", 4)) &&
+	strlen(bufp) < 6)
+  {
+    snprintf(buf, sizeof(buf), "%s %s", midi_player, name);
+    ks_system2(buf);
+    return 0;
+  }
 
   bzero(&sf, sizeof(sf));
   bzero(buf, sizeof(buf));