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
|
$NetBSD: patch-ac,v 1.1.1.1 2001/03/19 19:35:52 wiz Exp $
--- common/devices.cpp.orig Mon Sep 28 14:59:27 1998
+++ common/devices.cpp Sun Jan 28 14:22:54 2001
@@ -14,7 +14,7 @@
#include <fcntl.h>
#include <stdio.h>
#include <sys/ioctl.h>
-#include <sys/soundcard.h>
+#include <soundcard.h>
#include "modplay.h"
@@ -24,13 +24,26 @@
int val;
//DSP->fd = open(AUDIO_DEV, O_WRONLY|O_NONBLOCK);
- DSP->fd = open(DSP->name?DSP->name:AUDIO_DEV, O_WRONLY);
+ //DSP->fd = open(DSP->name?DSP->name:AUDIO_DEV, O_WRONLY);
+ if (DSP->rawdump) {
+ DSP->fd = open(DSP->name, O_WRONLY|O_CREAT);
+ } else {
+ DSP->fd = open(DSP->name?DSP->name:AUDIO_DEV, O_WRONLY);
+ }
+
if (DSP->fd == -1) {
return -1;
}
val = SND_FORMAT;
dsp_format:
+ if (DSP->rawdump) {
+ DSP->snd_format = SND_FORMAT;
+ DSP->bits_per_sample = 16;
+ DSP->stereo_support = 1;
+ DSP->sample_rate = DEFAULT_RATE;
+ return 0;
+ }
if (ioctl(DSP->fd, SNDCTL_DSP_SETFMT, &val) == -1) {
perror("ioctl SNDCTL_DSP_SETFMT failed");
exit(-1);
@@ -76,7 +89,7 @@
}
DSP->sample_rate = val;
- ioctl(DSP->fd, SNDCTL_DSP_RESET);
+ ioctl(DSP->fd, SNDCTL_DSP_RESET, NULL);
return 0;
}
|