~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/sound/designs/oss-emulation.rst

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /Documentation/sound/designs/oss-emulation.rst (Version linux-6.12-rc7) and /Documentation/sound/designs/oss-emulation.rst (Version policy-sample)


  1 =============================                     
  2 Notes on Kernel OSS-Emulation                     
  3 =============================                     
  4                                                   
  5 Jan. 22, 2004  Takashi Iwai <tiwai@suse.de>        
  6                                                   
  7                                                   
  8 Modules                                           
  9 =======                                           
 10                                                   
 11 ALSA provides a powerful OSS emulation on the     
 12 The OSS emulation for PCM, mixer and sequencer    
 13 as add-on kernel modules, snd-pcm-oss, snd-mix    
 14 When you need to access the OSS PCM, mixer or     
 15 corresponding module has to be loaded.            
 16                                                   
 17 These modules are loaded automatically when th    
 18 is called.  The alias is defined ``sound-servi    
 19 the card number and the minor unit number.  Us    
 20 define these aliases by yourself.                 
 21                                                   
 22 Only necessary step for auto-loading of OSS mo    
 23 card alias in ``/etc/modprobe.d/alsa.conf``, s    
 24                                                   
 25         alias sound-slot-0 snd-emu10k1            
 26                                                   
 27 As the second card, define ``sound-slot-1`` as    
 28 Note that you can't use the aliased name as th    
 29 ``alias sound-slot-0 snd-card-0`` doesn't work    
 30 modutils).                                        
 31                                                   
 32 The currently available OSS configuration is s    
 33 /proc/asound/oss/sndstat.  This shows in the s    
 34 /dev/sndstat, which is available on the commer    
 35 On ALSA, you can symlink /dev/sndstat to this     
 36                                                   
 37 Please note that the devices listed in this pr    
 38 after the corresponding OSS-emulation module i    
 39 even if "NOT ENABLED IN CONFIG" is shown in it    
 40                                                   
 41                                                   
 42 Device Mapping                                    
 43 ==============                                    
 44                                                   
 45 ALSA supports the following OSS device files:     
 46 ::                                                
 47                                                   
 48         PCM:                                      
 49                 /dev/dspX                         
 50                 /dev/adspX                        
 51                                                   
 52         Mixer:                                    
 53                 /dev/mixerX                       
 54                                                   
 55         MIDI:                                     
 56                 /dev/midi0X                       
 57                 /dev/amidi0X                      
 58                                                   
 59         Sequencer:                                
 60                 /dev/sequencer                    
 61                 /dev/sequencer2 (aka /dev/musi    
 62                                                   
 63 where X is the card number from 0 to 7.           
 64                                                   
 65 (NOTE: Some distributions have the device file    
 66 /dev/midi1.  They are NOT for OSS but for tclm    
 67 a totally different thing.)                       
 68                                                   
 69 Unlike the real OSS, ALSA cannot use the devic    
 70 assigned ones.  For example, the first card ca    
 71 /dev/dsp2, but only /dev/dsp0 and /dev/adsp0.     
 72                                                   
 73 As seen above, PCM and MIDI may have two devic    
 74 PCM device (``hw:0,0`` in ALSA) is mapped to /    
 75 device (``hw:0,1``) to /dev/adsp (if available    
 76 /dev/amidi, respectively.                         
 77                                                   
 78 You can change this device mapping via the mod    
 79 snd-pcm-oss and snd-rawmidi.  In the case of P    
 80 options are available for snd-pcm-oss:            
 81                                                   
 82 dsp_map                                           
 83         PCM device number assigned to /dev/dsp    
 84         (default = 0)                             
 85 adsp_map                                          
 86         PCM device number assigned to /dev/ads    
 87         (default = 1)                             
 88                                                   
 89 For example, to map the third PCM device (``hw    
 90 define like this:                                 
 91 ::                                                
 92                                                   
 93         options snd-pcm-oss adsp_map=2            
 94                                                   
 95 The options take arrays.  For configuring the     
 96 two entries separated by comma.  For example,     
 97 device on the second card to /dev/adsp1, defin    
 98 ::                                                
 99                                                   
100         options snd-pcm-oss adsp_map=0,2          
101                                                   
102 To change the mapping of MIDI devices, the fol    
103 available for snd-rawmidi:                        
104                                                   
105 midi_map                                          
106         MIDI device number assigned to /dev/mi    
107         (default = 0)                             
108 amidi_map                                         
109         MIDI device number assigned to /dev/am    
110         (default = 1)                             
111                                                   
112 For example, to assign the third MIDI device o    
113 /dev/midi00, define as follows:                   
114 ::                                                
115                                                   
116         options snd-rawmidi midi_map=2            
117                                                   
118                                                   
119 PCM Mode                                          
120 ========                                          
121                                                   
122 As default, ALSA emulates the OSS PCM with so-    
123 i.e. tries to convert the sample format, rate     
124 automatically when the card doesn't support it    
125 This will lead to some problems for some appli    
126 wine, especially if they use the card only in     
127                                                   
128 In such a case, you can change the behavior of    
129 writing a command to the proc file.  There is     
130 stream, ``/proc/asound/cardX/pcmY[cp]/oss``, w    
131 (zero-based), Y the PCM device number (zero-ba    
132 playback and ``c`` for capture, respectively.     
133 exists only after snd-pcm-oss module is loaded    
134                                                   
135 The command sequence has the following syntax:    
136 ::                                                
137                                                   
138         app_name fragments fragment_size [opti    
139                                                   
140 ``app_name`` is the name of application with (    
141 path.                                             
142 ``fragments`` specifies the number of fragment    
143 number is given.                                  
144 ``fragment_size`` is the size of fragment in b    
145 ``options`` is the optional parameters.  The f    
146 available:                                        
147                                                   
148 disable                                           
149         the application tries to open a pcm de    
150         this channel but does not want to use     
151 direct                                            
152         don't use plugins                         
153 block                                             
154         force block open mode                     
155 non-block                                         
156         force non-block open mode                 
157 partial-frag                                      
158         write also partial fragments (affects     
159 no-silence                                        
160         do not fill silence ahead to avoid cli    
161                                                   
162 The ``disable`` option is useful when one stre    
163 capture) is not handled correctly by the appli    
164 hardware itself does support both directions.     
165 The ``direct`` option is used, as mentioned ab    
166 conversion and useful for MMAP-applications.      
167 For example, to playback the first PCM device     
168 quake, send a command via echo like the follow    
169 ::                                                
170                                                   
171         % echo "quake 0 0 direct" > /proc/asou    
172                                                   
173 While quake wants only playback, you may appen    
174 to notify driver that only this direction is a    
175 ::                                                
176                                                   
177         % echo "quake 0 0 disable" > /proc/aso    
178                                                   
179 The permission of proc files depend on the mod    
180 As default it's set as root, so you'll likely     
181 sending the command above.                        
182                                                   
183 The block and non-block options are used to ch    
184 opening the device file.                          
185                                                   
186 As default, ALSA behaves as original OSS drive    
187 the file when it's busy. The -EBUSY error is r    
188                                                   
189 This blocking behavior can be changed globally    
190 module option of snd-pcm-oss.  For using the b    
191 for OSS devices, define like the following:       
192 ::                                                
193                                                   
194         options snd-pcm-oss nonblock_open=0       
195                                                   
196 The ``partial-frag`` and ``no-silence`` comman    
197 Both commands are for optimization use only.      
198 specifies to invoke the write transfer only wh    
199 filled.  The latter stops writing the silence     
200 automatically.  Both are disabled as default.     
201                                                   
202 You can check the currently defined configurat    
203 file.  The read image can be sent to the proc     
204 can save the current configuration                
205 ::                                                
206                                                   
207         % cat /proc/asound/card0/pcm0p/oss > /    
208                                                   
209 and restore it like                               
210 ::                                                
211                                                   
212         % cat /somewhere/oss-cfg > /proc/asoun    
213                                                   
214 Also, for clearing all the current configurati    
215 as below:                                         
216 ::                                                
217                                                   
218         % echo "erase" > /proc/asound/card0/pc    
219                                                   
220                                                   
221 Mixer Elements                                    
222 ==============                                    
223                                                   
224 Since ALSA has completely different mixer inte    
225 OSS mixer is relatively complicated.  ALSA bui    
226 from several different ALSA (mixer) controls b    
227 string.  For example, the volume element SOUND    
228 from "PCM Playback Volume" and "PCM Playback S    
229 playback direction and from "PCM Capture Volum    
230 Switch" for the capture directory (if exists).    
231 OSS is changed, all the volume and switch cont    
232 automatically.                                    
233                                                   
234 As default, ALSA uses the following control fo    
235                                                   
236 ====================    =====================     
237 OSS volume              ALSA control              
238 ====================    =====================     
239 SOUND_MIXER_VOLUME      Master                    
240 SOUND_MIXER_BASS        Tone Control - Bass       
241 SOUND_MIXER_TREBLE      Tone Control - Treble     
242 SOUND_MIXER_SYNTH       Synth                     
243 SOUND_MIXER_PCM         PCM                       
244 SOUND_MIXER_SPEAKER     PC Speaker                
245 SOUND_MIXER_LINE        Line                      
246 SOUND_MIXER_MIC         Mic                       
247 SOUND_MIXER_CD          CD                        
248 SOUND_MIXER_IMIX        Monitor Mix               
249 SOUND_MIXER_ALTPCM      PCM                       
250 SOUND_MIXER_RECLEV      (not assigned)            
251 SOUND_MIXER_IGAIN       Capture                   
252 SOUND_MIXER_OGAIN       Playback                  
253 SOUND_MIXER_LINE1       Aux                       
254 SOUND_MIXER_LINE2       Aux                       
255 SOUND_MIXER_LINE3       Aux                       
256 SOUND_MIXER_DIGITAL1    Digital                   
257 SOUND_MIXER_DIGITAL2    Digital                   
258 SOUND_MIXER_DIGITAL3    Digital                   
259 SOUND_MIXER_PHONEIN     Phone                     
260 SOUND_MIXER_PHONEOUT    Phone                     
261 SOUND_MIXER_VIDEO       Video                     
262 SOUND_MIXER_RADIO       Radio                     
263 SOUND_MIXER_MONITOR     Monitor                   
264 ====================    =====================     
265                                                   
266 The second column is the base-string of the co    
267 control.  In fact, the controls with ``XXX [Pl    
268 [Volume|Switch]`` will be checked in addition.    
269                                                   
270 The current assignment of these mixer elements    
271 file, /proc/asound/cardX/oss_mixer, which will    
272 ::                                                
273                                                   
274         VOLUME "Master" 0                         
275         BASS "" 0                                 
276         TREBLE "" 0                               
277         SYNTH "" 0                                
278         PCM "PCM" 0                               
279         ...                                       
280                                                   
281 where the first column is the OSS volume eleme    
282 the base-string of the corresponding ALSA cont    
283 control index.  When the string is empty, it m    
284 corresponding OSS control is not available.       
285                                                   
286 For changing the assignment, you can write the    
287 proc file.  For example, to map "Wave Playback    
288 send the command like the following:              
289 ::                                                
290                                                   
291         % echo 'VOLUME "Wave Playback" 0' > /p    
292                                                   
293 The command is exactly as same as listed in th    
294 change one or more elements, one volume per li    
295 example, both "Wave Playback Volume" and "Wave    
296 be affected when PCM volume is changed.           
297                                                   
298 Like the case of PCM proc file, the permission    
299 the module options of snd.  you'll likely need    
300 sending the command above.                        
301                                                   
302 As well as in the case of PCM proc file, you c    
303 current mixer configuration by reading and wri    
304 image.                                            
305                                                   
306                                                   
307 Duplex Streams                                    
308 ==============                                    
309                                                   
310 Note that when attempting to use a single devi    
311 capture, the OSS API provides no way to set th    
312 number of channels different in each direction    
313 ::                                                
314                                                   
315         io_handle = open("device", O_RDWR)        
316                                                   
317 will only function correctly if the values are    
318                                                   
319 To use different values in the two directions,    
320 ::                                                
321                                                   
322         input_handle = open("device", O_RDONLY    
323         output_handle = open("device", O_WRONL    
324                                                   
325 and set the values for the corresponding handl    
326                                                   
327                                                   
328 Unsupported Features                              
329 ====================                              
330                                                   
331 MMAP on ICE1712 driver                            
332 ----------------------                            
333 ICE1712 supports only the unconventional forma    
334 10-channels 24bit (packed in 32bit) format.  T    
335 the buffer as the conventional (mono or 2-chan    
336 on OSS.                                           
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php