ALSA configuration file

Source: Internet
Author: User

ALSA configuration file is very important for ALSA. There are three common examples: ALSA. conf, asoundrc, and asound. conf.

1. Core configuration fileThe core ALSA configuration file is located in the/usr/share/ALSA/directory. The main configuration file is/usr/share/ALSA. conf. Whether or not other files are required and where they are located are determined by ALSA. conf. The/usr/share/ALSA/card and/usr/share/ALSA/PCM subdirectories are usually used to set card-related parameters, aliases, and some PCM default settings. In addition, in ALSA. conf, the/etc/asound. conf and ~ /. Asoundrc configuration files. These two files are usually placed with parameters that require special settings. According to the official ALSA documents, after version 1.0.9, these two files are no longer necessary or even unnecessary. At least it is not recommended. However, for the sake of simplicity and convenience of testing, we need to modify these two files in an embedded system.


2. ALSA. confThe main contents in ALSA. conf include: 1)Read/etc/asound. conf and ~ with Hook ~ /. Asoundrc configuration files: @ Hooks [{func load files ["/etc/asound. conf ""~ /. Asoundrc "] errors false}] 2)
Some default parameters of default PCM are set, for example, card 0 and device 0 are used as the audio device by default.Defaults. CTL. Card 0defaults. PCM. Card 0defaults. PCM. device 0 defaults. PCM. subdevice-1defaults. PCM. nonblock 1defaults. PCM. ipc_key 5678293... 3)
You have set some built-in plug-in interface parameters of ALSA, such as file:PCM. file {@ ARGs [file format] @ args. file {type string} @ args. format {type stringdefault raw} type fileslave. PCM nullfile $ fileformat $ format} file plugin stores PCM data streams to files.


3. asoundrc and asound. confAccording to ALSA, asoundrc is a configuration file for individual users, and asound. conf is a global configuration file. Here, asoundrc is located in the main directory and is a hidden file: ". asoundrc ". Asound. conf is located in the/etc directory. For the latest ALSA library, these two files are no longer needed. But for some specific applications, their use is just right. The typical asoundrc file is 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 saving, recovery, and automatic loadingIn actual use, you often need to dynamically modify the configuration information of the Sound Card, such as updating the mixer information in asoundrc. If you do not save the configuration status of the current sound card, the system will be restored to the original status the next time you start the system. Therefore, it is necessary to save the configuration status of the sound card. The sound card configuration status saving tool is alsactl. The specific saving command is:Alsactl store-F/var/lib/ALSA/asound. StateIn this way, the asound. State file is generated under the/var/lib/ALSA/directory, which stores the state configuration information of the Sound Card, including common mixer configuration information. The corresponding sound card status recovery command is: alsactl
Restore-F/var/lib/ALSA/asound. state Note: after each modification to the sound card configuration file, make sure that the configuration file is loaded by the system. Otherwise, when saving the sound card configuration status information, alsactl reads the status of the last sound card. A common method to load a configuration file is to play an audio file, for example, speaker-test-twav, so that the modified configuration file can be loaded into the system, then run the corresponding save command to save the sound card status information to the file.

The configuration status information of the sound card still does not ensure that the system automatically loads and applies the status information at startup. You need to modify the startup configuration file and add it to ALSA daemon. Start the configuration file:/etc/rc. conf and add the Alsa project to the line containing daemons. In this way, the system will automatically execute the/etc/rc. d/ALSA script at startup, which will automatically execute the sound card status recovery command mentioned above to restore the 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.