summaryrefslogtreecommitdiff
path: root/graphics/xanim/patches/patch-ac
blob: 1908dbfa8878f36b17469f9220d733642f0b6faf (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
--- xa_audio.c.orig	Mon Mar 23 18:54:59 1998
+++ xa_audio.c	Sun Apr 26 12:04:40 1998
@@ -4508,31 +4508,53 @@
   a_info.blocksize = 1024;
   ioctl(devAudio, AUDIO_SETINFO, &a_info);
   AUDIO_INITINFO(&a_info);
-
-#ifndef AUDIO_ENCODING_SLINEAR
-  a_info.play.encoding = AUDIO_ENCODING_PCM16;
-#else
-	/* NetBSD-1.3 */
-  a_info.play.encoding = AUDIO_ENCODING_SLINEAR; /* Signed, nativeorder */
-#endif
-  ioctl(devAudio, AUDIO_SETINFO, &a_info);
-  AUDIO_INITINFO(&a_info);
   a_info.mode = AUMODE_PLAY | AUMODE_PLAY_ALL;
   ioctl(devAudio, AUDIO_SETINFO, &a_info);
+#ifdef AUDIO_ENCODING_SLINEAR
+  /* Use new encoding names */
   AUDIO_INITINFO(&a_info);
+  a_info.play.encoding = AUDIO_ENCODING_SLINEAR;
   a_info.play.precision = 16;
+  if (ioctl(devAudio, AUDIO_SETINFO, &a_info) < 0) {
+    AUDIO_INITINFO(&a_info);
+    a_info.play.encoding = AUDIO_ENCODING_ULINEAR;
+    a_info.play.precision = 8;
+    ioctl(devAudio, AUDIO_SETINFO, &a_info);
+  }
+#else
+  AUDIO_INITINFO(&a_info);
+  a_info.play.encoding = AUDIO_ENCODING_PCM16;
+  a_info.play.precision = 16;
+  if (ioctl(devAudio, AUDIO_SETINFO, &a_info) < 0) {
+    AUDIO_INITINFO(&a_info);
+    a_info.play.encoding = AUDIO_ENCODING_PCM;
+    a_info.play.precision = 8;
+    ioctl(devAudio, AUDIO_SETINFO, &a_info);
+  }
+#endif
+  AUDIO_INITINFO(&a_info);
+  a_info.play.channels = /*2*/1;
   ioctl(devAudio, AUDIO_SETINFO, &a_info);
   AUDIO_INITINFO(&a_info);
-  a_info.play.sample_rate = 11025;
+  a_info.play.sample_rate = 22050;
   ioctl(devAudio, AUDIO_SETINFO, &a_info);
   ioctl(devAudio, AUDIO_GETINFO, &a_info);
 
-  xa_audio_hard_type  = (a_info.play.precision==8)?XA_AUDIO_LINEAR_1M
-						  :XA_AUDIO_SIGNED_2ML;
+  if (a_info.play.channels == 2)
+    if (a_info.play.precision == 8)
+      xa_audio_hard_type = XA_AUDIO_LINEAR_1S;
+    else
+      xa_audio_hard_type = XA_AUDIO_SIGNED_2SL;
+  else
+    if (a_info.play.precision == 8)
+      xa_audio_hard_type = XA_AUDIO_LINEAR_1M;
+    else
+      xa_audio_hard_type = XA_AUDIO_SIGNED_2ML;
   xa_audio_hard_freq  = a_info.play.sample_rate;
   xa_audio_hard_buff  = a_info.blocksize;
-  xa_audio_hard_bps   = (a_info.play.precision==8)?1:2;
-  xa_audio_hard_chans = 1;
+  xa_audio_hard_bps   = a_info.play.precision / 8;
+  xa_audio_hard_chans = a_info.play.channels;
+
   Gen_Ulaw_2_Signed();
   Gen_Signed_2_Ulaw();