目录(?)[-]
Copyright:http://blog.csdn.net/myzhzygh/article/details/8468210
The Advanced Linux Sound Architecture(ALSA) is a Linux kernel component intended to replace the original OpenSound System (OSSv3) for providing device drivers for sound cards. Besides thesound device drivers,ALSA also bundles a user space library forapplication developers who want to use driver features with a higher level APIthan direct interaction with the kernel drivers. In a word, the Advanced LinuxSound Architecture (ALSA) comes with a kernel API and a library API.
ALSA was designed to use some featureswhich were not, at the time of its conception, supported by theOpen SoundSystem (OSS):
ALSA has a larger and more complex API than OSS, so it can be harder to develop anapplication that uses ALSA as its sound technology. While ALSA may beconfigured to provide an OSSemulation layer, such functionality is no longer available in many Linuxdistributions.
Besides the sound device drivers, ALSAbundles a user spacelibrary for application developers whowant to use driver features through an interface that is higher level than the interface provided fordirect interaction with the kernel drivers; unlike the kernel API, which triesto reflect the capabilities of the hardware directly, ALSA's user space librarypresents an abstraction which remains as standardized as possible acrossdisparate underlying hardware. This goal is achieved in part by using softwareplugins. For example, many modern soundcards or built-in sound chips don't havea "master volume" control; for these devices, the user space libraryinstead provides a software volume control using the "softvol"plugin, and ordinary application software need not care whether such a controlis implemented by actual underlying hardware or software emulation of suchunderlying hardware.
This section provides an overview of basicconcepts pertaining to ALSA.
Typically, ALSA supports up to eight cards,numbered 0 through 7; each card is a physical or logical kernel device capableof input, output, or control of sound, and card number 0 is used by defaultwhen no particular card is specified. Furthermore, each card may also beaddressed by its id, which is an explanatory string such as "Headset"or "ICH9".
A card has devices, numberedstarting at 0; a device may be of playback type, meaning it outputssound from the computer, or some other type such ascapture,control,timer, orsequencer; device number 0 is used by default when noparticular device is specified.
A device may have subdevices,numbered starting at 0; a subdevice represents some relevant sound endpoint forthe device, such as a speaker pair. If the subdevice is not specified, or ifsubdevice number -1 is specified, then any available subdevice is used.
A card's interface is a descriptionof an ALSA protocol for accessing the card; possible interfaces include:hw,plughw,default, andplug:dmix. Thehw interfaceprovides direct access to the kernel device, but no software mixing or streamadaptation support. Theplughw anddefault enable sound outputwhere thehw interface would produce an error.
An application typically describes soundoutput by combining all of the aforementioned specifications together in adevicestring, which has one of the following forms (which arecasesensitive):
An ALSA stream is a data flowrepresenting sound; the most common stream format isPCM that must be produced in such a way asto match the characteristics or parameters of the hardware, including:
Also, ALSA needs a buffer parameter thatdetermines how often CPU attention is required to supply sound data.
The currently designed interfaces arelisted below:
For the VIA EITX-3002, you might also wantto check the directory /dev/snd for the right device files:
The ALSA library API is the interface tothe ALSA drivers. Developers need to use the functions in this API to achievenative ALSA support for their applications, instead of kernel API. How itinterfaces with the kernel API is focused by the library API. Applicationprogrammers should use the library API rather than the kernel API. The libraryoffers 100% of the functionality of the kernel API, but adds major improvementsin usability, making the application code simpler and better looking. Inaddition, future fixes or compatibility code may be placed in the library codeinstead of the kernel driver.
Tinyalsa is a small library to interface withALSA in the Linux kernel.
Tinyalsa basic files list:
- pcm.c for control interface
- mixer.c for pcminterface
, and provide three tools:
- tinyplay.c for play
- tinycap.c for capture
- tinymixer.c for mixer
Tinyalsa is a small ALSA library, in orderto substituting for original ALSA library in Android platform. The aims are:
Provide a basic pcm and mixer API toimplement the Audio HAL (Hardware Abstract Level) for Android platform.
|
Tinyalsa |
ALSA-lib |
Control Interface |
Partly support |
Completely support |
Mixer Interface |
---- |
Completely support |
PCM Interface |
Partly support |
Completely support |
Raw MIDI Interface |
---- |
Completely support |
Sequencer Interface |
---- |
Completely support |
Timer Interface |
---- |
Completely support |
We can use ALSA-lib substitute for Tinyalsacompletely, but we can’t use Tinyalsa substitute for ALSA-lib completely. But,in some times, Tinyalsa can substitute for ALSA-lib to work for some basicfunction.
Notice: The following function Interfacesupplied by tinyalsa is not implemented.
/* Set and get config */
int pcm_get_config(structpcm *pcm, struct pcm_config *config);
int pcm_set_config(struct pcm *pcm, struct pcm_config *config);
/* Returns the pcm latency in ms */
unsigned int pcm_get_latency(struct pcm *pcm);
http://www.alsa-project.org/main/index.php/Main_Page
http://en.wikipedia.org/wiki/Advanced_Linux_Sound_Architecture
https://wiki.archlinux.org/index.php/Advanced_Linux_Sound_Architecture