Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

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