summaryrefslogtreecommitdiff
path: root/audio/timidity/patches/patch-aa
blob: cb74ef281f6996b6310caaa16fd451256ae30a81 (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
55
$NetBSD: patch-aa,v 1.8 2009/04/10 18:45:16 wiz Exp $

--- timidity/sun_a.c.orig	2004-09-26 23:40:14.000000000 +0000
+++ timidity/sun_a.c
@@ -296,6 +296,18 @@ int output_data(char *buff, int32 nbytes
 
 
 #if !defined(I_FLUSH) || !defined(FLUSHW)
+#  if defined(AUDIO_FLUSH)	/* NetBSD */
+static int sun_discard_playing(void)
+{
+    if(ioctl(dpm.fd, AUDIO_FLUSH, NULL) < 0)
+    {
+	ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: (ioctl) %s",
+		  dpm.name, strerror(errno));
+	return -1;
+    }
+    return 0;
+}
+#  else
 static void null_proc(){}
 static int sun_discard_playing(void)
 {
@@ -308,6 +320,7 @@ static int sun_discard_playing(void)
     signal(SIGALRM, orig_alarm_handler);
     return open_output();
 }
+#  endif
 #else
 static int sun_discard_playing(void)
 {
@@ -328,6 +341,23 @@ static int acntl(int request, void *arg)
 
     switch(request)
     {
+#ifdef __NetBSD__
+      case PM_REQ_GETQSIZ:
+	if(ioctl(audioctl_fd, AUDIO_GETINFO, &auinfo) < 0)
+	    return -1;
+	*((int *)arg) = auinfo.play.buffer_size;
+	return 0;
+
+      case PM_REQ_GETFRAGSIZ:
+	if(ioctl(audioctl_fd, AUDIO_GETINFO, &auinfo) < 0)
+	    return -1;
+	*((int *)arg) = auinfo.blocksize;
+	return 0;
+
+      case PM_REQ_OUTPUT_FINISH:
+	return ioctl(audioctl_fd, AUDIO_DRAIN, NULL);
+#endif
+
       case PM_REQ_GETFILLED:
 	if(ioctl(audioctl_fd, AUDIO_GETINFO, &auinfo) < 0)
 	    return -1;