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
|
$NetBSD: patch-ac,v 1.6 2007/01/21 04:02:01 rillig Exp $
--- audioIO_SunOS.c.orig 1997-05-31 19:47:58.000000000 +0200
+++ audioIO_SunOS.c 2007-01-21 04:50:43.135430140 +0100
@@ -8,7 +8,11 @@
#include "amp.h"
#include <sys/types.h>
+#ifndef OS_NetBSD
#include <sys/stropts.h>
+#else
+#include <sys/ioctl.h>
+#endif
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
@@ -18,7 +22,7 @@
/* declare these static to effectively isolate the audio device */
-static audio_fd;
+static int audio_fd;
static audio_info_t auinfo;
/* audioOpen() */
@@ -31,13 +35,12 @@ audioOpen(int frequency, int stereo, int
{
int res;
- if ((audio_fd = open("/dev/audio",O_RDWR))==-1) {
+ if ((audio_fd = open("/dev/audio",O_WRONLY))==-1) {
die(" unable to open the audio device\n");
}
DB(audio, msg("Audio device opened on %d\n",audio_fd) );
- if (ioctl(audio_fd,AUDIO_GETINFO,&auinfo)<0)
- die("Unable to get audio info\n");
+ AUDIO_INITINFO(&auinfo);
auinfo.play.precision=16;
auinfo.play.encoding=AUDIO_ENCODING_LINEAR;
@@ -70,7 +73,7 @@ audioSetVolume(int volume)
/* audioFlush() */
/* should flush the audio device */
-inline void
+void
audioFlush()
{
DB(audio, msg("audio: flush %d\n",audio_fd) );
@@ -91,7 +94,7 @@ audioClose()
/* writes count bytes from buffer to the audio device */
/* returns the number of bytes actually written */
-int inline
+int
audioWrite(char *buffer, int count)
{
return(write(audio_fd,buffer,count));
|