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
|
$NetBSD: patch-ad,v 1.1.1.1 2004/01/26 13:34:45 jmmv Exp $
--- Lib/sound.cc.orig Wed Sep 1 08:10:03 1999
+++ Lib/sound.cc
@@ -26,7 +26,11 @@
#include <fcntl.h>
#include <sys/ioctl.h>
#ifndef NOSOUND
-#include <linux/soundcard.h>
+#ifdef HAVE_SOUNDCARD_H
+#include <soundcard.h>
+#else
+#include <sys/soundcard.h>
+#endif
#endif
#ifdef RCSID
@@ -56,16 +60,16 @@ void
Sound::setSoundFlags(long f) {
switch (GET_SOUND_RATE_CODE(f)) {
case 0:
- soundRate = 5500;
+ soundRate = 5512;
break;
case 1:
- soundRate = 11000;
+ soundRate = 11025;
break;
case 2:
- soundRate = 22000;
+ soundRate = 22050;
break;
case 3:
- soundRate = 44000;
+ soundRate = 44100;
break;
}
if (f & soundIs16bit) {
@@ -162,7 +166,7 @@ SoundMixer::SoundMixer(char *device)
}
// Reset device
- status = ioctl(dsp, SNDCTL_DSP_RESET);
+ status = ioctl(dsp, SNDCTL_DSP_RESET, NULL);
if (status < 0) perror("ioctl SNDCTL_DSP_RESET");
// Set sample size
@@ -187,7 +191,7 @@ SoundMixer::SoundMixer(char *device)
}
// Set sound rate in Hertz
- soundRate = 11000;
+ soundRate = 11025;
status = ioctl(dsp, SNDCTL_DSP_SPEED, &soundRate);
if (status < 0) perror("ioctl SNDCTL_DSP_SPEED");
@@ -324,7 +328,7 @@ SoundMixer::playSounds()
if (nbBytes) {
// At last ! Play It !
write(dsp,buffer,nbBytes);
- status = ioctl(dsp, SNDCTL_DSP_POST);
+ status = ioctl(dsp, SNDCTL_DSP_POST, NULL);
}
return nbBytes;
|