summaryrefslogtreecommitdiff
path: root/misc/man9ossddk/ossddk_install_audiodev.9ossddk
blob: f5c3c7974658d71a78656273c0f01259bff07699 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
'\" te
.\"  Copyright (c) 2005, 4Front Technologies 2005\&.
.TH ossddk_install_audiodev 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services"
.SH "NAME"
ossddk_install_audiodev \- Install an audio device
.PP
.SH "SYNOPSIS"
.nf
#include <sys/soundcard.h>
.LP
#include <sys/ossddk/ossddk.h>
.fi
.LP
\fBint\fR ossddk_install_audiodev(\fBint \fIvers\fP, \fBoss_device_t * \fIosdev\fP, \fBoss_device_t * \fImaster_osdev\fP, \fBchar *\fIname\fP, \fBconst audiodrv_t *\fIdriver\fP, \fBint \fIdriver_size\fP, \fBint \fIflags\fP, \fBunsigned int \fIformat_mask\fP, \fBvoid *\fIdevc\fP, \fBint \fIparent\fP);
.PP
.SH "INTERFACE LEVEL"
.PP
Open Sound System specific (OSS 4.0 DDK)\&.
.PP
.SH "ARGUMENTS"
.PP
.sp
.ne 2
.mk
\fB\fIvers\fR
.in +16n
.rt
Audio driver interface version. Must be set to OSS_AUDIO_DRIVER_VERSION.
.in -16n
.sp
.ne 2
.mk
\fB\fIosdev\fR
.in +16n
.rt
OSS device handle. Returned by ossddk_register_device.
.in -16n
.sp
.ne 2
.mk
\fB\fImaster_osdev\fR
.in +16n
.rt
OSS device handle for the master device. Usually same as \fIosdev\fR but
virtual drivers have to give the osdev handle of the master/physical device here.
OSS uses this parameter for example to get the right iblock_cookie.
.in -16n
.sp
.ne 2
.mk
\fB\fIname\fR
.in +16n
.rt
Name of the device. This name will be reported in /dev/sndstat as well as to
the applications using SNDCTL_AUDIOINFO(2oss) ioctl (such as ossinfo).
.in -16n
.sp
.ne 2
.mk
\fB\fIdriver\fR
.in +16n
.rt
Pointer to the audio_driver structure that defines the entry points for
this low level audio driver.
.in -16n
.sp
.ne 2
.mk
\fB\fIdriver_size\fR
.in +16n
.rt
Size of the driver structure. Pass sizeof(audiodrv_t) in this parameter.
.in -16n
.sp
.ne 2
.mk
\fB\fIflags\fR
.in +16n
.rt
Audio device flags (see the description below).
.in -16n
.sp
.ne 2
.mk
\fB\fIformat_mask\fR
.in +16n
.rt
Bit mask describing the sample formats supported by the device. See the \fISupported Audio Formats\fR section of OSS v4.0 API reference for more info. For example 
\fBAFMT_S16_LE|AFMT_U8\fR tells that the driver supports the industry standard 8 and 16
bit audio formats.
.PP
If the device supports different formats for recording and playback the driver should use the \fIossddk_adev_set_formats(9ossddk)\fR routine to set the masks.
.in -16n
.sp
.ne 2
.mk
\fB\fIdevc\fR
.in +16n
.rt
Pointer to driver defined device instance data.
.in -16n
.sp
.ne 2
.mk
\fB\fIparent\fR
.in +16n
.rt
Reserved for future use. Set to -1.
.in -16n
.PP
.SH "DESCRIPTION"
.PP
\fIossddk_install_audiodev\fR creates an audio device file (/dev/dsp0 to /dev/dspN) and installs its driver callbacks. By default the device will be input/output capable.

Behaviour of the driver can be modified using the \fIflags\fR parameter in the following way:
.PP
.sp
.ne 2
.mk
\fBADEV_DUPLEX\fR
.in +30n
.rt
Give this flag if this device supports full duplex (simultaneous recording and playback).
.in -30n
.sp
.ne 2
.mk
\fBADEV_NOINPUT\fR
.in +30n
.rt
Set this flag if the device doesn't do recording (ie it's playback only).
.in -30n
.sp
.ne 2
.mk
\fBADEV_NOOUTPUT\fR
.in +30n
.rt
Set this flag if the device doesn't do playback (ie it's recording only).
.in -30n
.sp
All new OSS drivers should create separate device files for input and output. Earlier OSS versions created just a single input/output device file with \fBADEV_DUPLEX\fR flag.
However this approach doesn't work with all device so it should not be used any more.
.sp
.ne 2
.mk
\fBADEV_VIRTUAL\fR
.in +30n
.rt
This flag tells that this device is virtual which means that it doesn't drive any
real hardware device. Instead it performs some software-only processing or works on
top of some other device. This flag is used to prevent chaining multiple virtual
drivers. Also some applications using SNDCTL_AUDIOINFO(2oss) may use this flag 
for some purposes.
.in -30n
.sp
.ne 2
.mk
\fBADEV_NOCONVERT\fR
.in +30n
.rt
This flag prevents the audio core from doing any automatic sample rate or format
conversions with this device. This flag should be set only if there is some strong 
reason to prevent the conversions.
.in -30n
.sp
.ne 2
.mk
\fBADEV_HIDDEN\fR
.in +30n
.rt
This flag means that the device serves some very special purpose and it should
be hidden from ordinary audio applications. It will not be visible in
device selection lists shown by applications. Instead the user/administrator
should know the device file to use.
.in -30n
.sp
.ne 2
.mk
\fBADEV_SHADOW\fR
.in +30n
.rt
Some devices have multiple audio playback engines that are functionally identical
(in theory this kind of input devices are possible too but). An OSS audio driver
is supposed to create one audio device file for each of the available engines. All but 
the first one should have this flag set.
.in -30n
.sp
.ne 2
.mk
\fBADEV_NOSRC\fR
.in +30n
.rt
This flag disables automatic sample rate conversions performed by the audio core of OSS.
It's similar than the \fBADEV_NOCONVERT\fR flag but doesn't disable other kind of
format conversions. Usually used with rofessional audio devices (digital ones in
particular) to prevent lossy sample rate conversions.

.in -30n
.sp
.ne 2
.mk
\fBADEV_SPECIAL\fR
.in +30n
.rt
Use this flag with devices that should not be used to play system sounds (warning beeps,
etc). For example multi channel only or digital (AES/EBU or S/PDIF) devices should
specify this flag.
.in -30n
.sp
.ne 2
.mk
\fBADEV_NOMMAP\fR
.in +30n
.rt
Use this flag if the device doesn't support mmap (direct access to the DMA buffer) for
some reason.
.in -30n
.sp
.ne 2
.mk
\fBADEV_DISABLE_VIRTUAL\fR
.in +30n
.rt
Use this flag if the device is not suitable to be used as a master device of some
virtual driver. This flag should be set for example when the interrupt routine of
this device uses large amounts of stack (which may cause a stack overflow when
the virtual driver gets invoked).
.in -30n
.sp
.ne 2
.mk
.PP
.SH "RETURN VALUES"
.PP
Negative value is an error code (-errno). Zero or positive is the audio device
number created.
.PP
.SH "SEE ALSO"
.PP
\fIWriting Sound Device Drivers with OSS DDK\fR
\fIOpen Sound System Programmer's Guide\fR