ALSA configuration file

Source: Internet
Author: User

ALSA configuration files are important for ALSA. There are three common: alsa.conf, ASOUNDRC, asound.conf.
1. Core profile ALSA core configuration file is located in the/usr/share/alsa/directory, the main profile is/usr/share/alsa/alsa.conf. Whether the other documents are needed or not is determined by alsa.conf. There are usually/usr/share/alsa/card and/USR/SHARE/ALSA/PCM two subdirectories that set up card-related parameters, aliases, and some PCM defaults. In addition, in alsa.conf, the/etc/asound.conf and ~/.ASOUNDRC configuration files are often referenced, which are usually related to the placement of individual needs special settings. According to Alsa's official document, after the 1.0.9 version, these two files are no longer necessary or even desirable. At least it is not recommended to use. However, in the embedded system, for simplicity and convenience testing, it is precisely necessary to modify these two files.


2.The main elements of alsa.conf alsa.conf include: 1 the /etc/asound.conf and ~/.ASOUNDRC are read by hooks : @hooks [{func Load files ["/etc/asound.conf" "~/.ASOUNDRC"] errors false}]2) set Some default parameters of default PCM, such as card 0, Device 0 as audio device, etc. Wait defaults.ctl.card 0defaults.pcm.card 0defaults.pcm.device 0 defaults.pcm.subdevice-1defaults.pcm.nonblock 1defaults.pcm.ipc_key 5678293 ... 3 Set the ALSA built-in plugin interface parameters, such as file:pcm.file {@args [file FORMAT] @args. The FILE {type string} @args. The role of the FORMAT {type Stringdefault raw}type fileslave.pcm nullfile $FILEformat $FORMAT}file plugin is to store the PCM data stream in a file.


3. According to ALSA, ASOUNDRC and asound.conf , ASOUNDRC is a profile for individual users, and asound.conf is a global configuration file. Where ASOUNDRC is located in the home directory and is a hidden file: ". ASOUNDRC". Asound.conf is located in the/etc directory. For the latest version of the ALSA library, these two files are no longer needed. But for some specific applications, their use is just right. Typical ASOUNDRC files are as follows: # Overwrite existing devicespcm.! Default{type plugslave.pcm "Softvol" channels 2} # ADD new Sofvol PCM devicepcm.softvol{type SOFTVOLSLAVE{PCM "hw:0,0"}
Control{name "Softmaster" card 0}}


4. ALSA Configuration status preservation, recovery and automatic loading in the actual use of the process, often need to dynamically modify the sound card configuration information, such as update ASOUNDRC in the mixer information. If you do not save the current sound card configuration state, the next time you start the system, it will revert to its original state. For this reason, it is necessary for us to save the configuration state of the sound card. Sound card Configuration State Save tool is: Alsactl, the specific Save command is: alsactl store-f/var/lib/alsa/asound.state This is in/var/lib/alsa/ A asound.state file is generated in the directory that holds the state configuration information for the sound card, including the commonly used mixer configuration information. The appropriate sound card status Recovery command is: Alsactl restore-f/var/lib/alsa/ Asound.state Note: After each modification of the sound card configuration file, you must ensure that the configuration file is loaded by the system, otherwise, when you save the sound card configuration status information, Alsactl read the last sound card status. The common way to load a configuration file is to play an audio file, such as: Speaker-test-twav This allows you to load the configuration file that you just modified into the system, and then execute the appropriate save command to save the appropriate sound card state information to a file.

The configuration status information of the sound card is still not guaranteed to automatically load and apply state information when the system starts. You need to modify the startup configuration file to join Alsa Daemon. The startup profile is:/etc/rc.conf, adding the ALSA project in a row that contains daemons. In this way, the/etc/rc.d/alsa script is automatically executed when the system starts, and the script automatically executes the sound card State Recovery command described previously, restoring mixer configuration information.


View Original: HTTP://HI.BAIDU.COM/LIUHELISHUANG/ITEM/9938F13B3DAEA34A033EDCBB

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.