summaryrefslogtreecommitdiff
path: root/emulators/xbeeb/patches/patch-ab
blob: ec9c4379589f64cf0c719d7d89be9361fa40b385 (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
$NetBSD: patch-ab,v 1.3 2006/06/17 06:37:55 dsainty Exp $

Make sure ioctl() gets a third dummy argument, for the three argument macro
defined in the NetBSD OSS emulation soundcard.h.

rand() is too weak to generate quality white noise, use random() instead.

--- src/SoundOSS.c.orig	2002-01-16 04:46:43.000000000 +1300
+++ src/SoundOSS.c	2006-06-03 18:25:08.000000000 +1200
@@ -106,7 +106,7 @@
 		return;
 	}
 
-	if ( ioctl ( SoundFD, SNDCTL_DSP_RESET ) < 0 ) {
+	if ( ioctl ( SoundFD, SNDCTL_DSP_RESET, &dummy ) < 0 ) {
 		fprintf ( stderr, "Can't reset sound device\n" );
 		return;
 	}
@@ -328,13 +328,13 @@
 					SampleState[c] ^= 1;
 				else {
 					if ( SoundFb )
-						SampleState[c] = rand() & 1;
+						SampleState[c] = random() & 1;
 					else {
 						if ( pnoise++ == 10240 ) {
-							srand(time(0));
+							srandom(time(0));
 							pnoise = 0;
 						}
-						SampleState[c] = rand() & 1;
+						SampleState[c] = random() & 1;
 					}
 				}
 			}