summaryrefslogtreecommitdiff
path: root/games/rocksndiamonds/patches/patch-ad
blob: ba8684c5fe15af35ad887f1840878f7193ee218b (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
$NetBSD: patch-ad,v 1.2 2001/07/05 22:07:59 kristerw Exp $
--- src/libgame/sound.c.orig	Sun Dec 31 11:47:19 2000
+++ src/libgame/sound.c	Thu Jul  5 23:37:59 2001
@@ -291,7 +291,30 @@
 	     - 2 buffers / 512 bytes (giving 1/16 second resolution for 8 kHz)
 	     - (with stereo the effective buffer size will shrink to 256)
 	     => fragment_size = 0x00020009 */
+#if defined(PLATFORM_NETBSD)
+	  {
+	    audio_info_t a_info;
 
+	    AUDIO_INITINFO(&a_info);
+	    a_info.play.encoding = AUDIO_ENCODING_LINEAR8;
+	    a_info.play.precision = 8;
+	    a_info.play.channels = 2;
+	    a_info.play.sample_rate = sample_rate;
+	    a_info.blocksize = fragment_size;
+	    if (ioctl(audio.device_fd, AUDIO_SETINFO, &a_info) < 0)
+	    {
+	      /* Try to disable stereo. */
+	      a_info.play.channels = 1;
+	      stereo = FALSE;
+	      if (ioctl(audio.device_fd, AUDIO_SETINFO, &a_info) < 0)
+	      {
+	        Error(ERR_EXIT_SOUND_SERVER,
+                      "cannot set sample rate of /dev/audio - no sounds");
+                playing_sounds = 0;
+	      }
+            }
+          }
+#else
 	  if (ioctl(audio.device_fd,SNDCTL_DSP_SETFRAGMENT,&fragment_spec) < 0)
 	    Error(ERR_EXIT_SOUND_SERVER,
 		  "cannot set fragment size of /dev/dsp - no sounds");
@@ -319,7 +342,7 @@
 	  if (ioctl(audio.device_fd, SNDCTL_DSP_GETBLKSIZE,&fragment_size) < 0)
 	    Error(ERR_EXIT_SOUND_SERVER,
 		  "cannot get fragment size of /dev/dsp - no sounds");
-
+#endif
 	  max_sample_size = fragment_size / (stereo ? 2 : 1);
 	}