Experience of porting and compiling ALSA audio architecture alsa-lib Embedded Linux

Source: Internet
Author: User

*************************************************************************************************************** ************
Easywave Time: 2014.10.25

Category: Linux application-alsa audio architecture Alsa-lib porting to compilation declaration: reprint, please keep the link

Note: If there is an error, please correct me. These are the journal articles I studied ...

*************************************************************************************************************** ************

One: ALSA Audio Architecture Introduction

ALSA is the abbreviation for Advanced Linux Sound Architecture, a premium Linux voice architecture that provides audio and MIDI (musical instrument Digital Interface on Linux operating systems, Music Device Digital Interface) support. In the 2.6 series kernel, ALSA has become the default sound subsystem to replace the OSS (open Sound System) in the 2.4 series kernel. Key features of ALSA include: efficient support for all types of audio interfaces from consumer entry-level sound cards to professional-grade audio devices, fully modular design, support for symmetric multi-processing (SMP) and thread safety, backward compatibility with OSS, and a alsa-lib library that provides user space to simplify application development.

ALSA is a fully open source audio driver set, in addition to providing a set of kernel driver modules like OSS, ALSA also provides a library of functions for simplifying application writing, compared to the original IOCTL-based programming interface provided by OSS. The ALSA function library is more convenient to use. With this library, developers can quickly and easily develop their own applications, the details are left to the function library internal processing. Of course ALSA also provides a system interface similar to OSS, but ALSA developers recommend that application developers use the audio library instead of the driver's API.


II: ALSA official website

The web site of the open source Alsa architecture is as follows: Http://www.alsa-project.org/main/index.php/Main_Page


I am not downloading the latest version of the alsa-lib-1.0.28, but alsa-lib-1.0.26, the main reason is to choose a lower version of the stability of the version. The file schema for Alsa-lib is as follows:



III: ALSA porting and compiling

There have been a lot of strange problems in Alsa-lib's transplant, and of course this is related to all of my current UCLIBC versions, For the version below uClibc-0.9.23 uclibc, need to ALSA Library source code to update, otherwise there will be compile failure problem, this I one by one.

1): ' Versionsort ' undeclared error

the ' versionsort ' undeclared error message is as follows:


This is because uclibc if lower than 0.9.23, this problem will occur, because in uClibc-0.9.32 below the version of the Versionsort function is not caused, this can be seen in the source code of UCLIBC, In the uClibc-0.9.32 version there is the versionsort function, as shown below:


Below this version uclibc does not have this function and the file, then needs to download a patch package, and will transplant it to the alsa-lib. If your version of the UCLIBC itself is higher than this, you can skip this section. The patch package files are as follows:


Hit the patch with the following command, as shown below:


This is only the first step, if you just lay the patch, there will be a ' versionsort ' undeclared error hint, but not in the parse.c file, but in the Conf.c file, as follows:


This can not be used in the above method to patch the way to solve, otherwise it will appear versionsort Repeat the definition of the error, how to do it, then only versionsort ported to the Alsa-lib library. First, copy the


At the same time, modify the makefile.am file, plus this file, as follows:


You also need to include a line of code in the Alsa-lib/include/local.h file as follows:


Re-modify the compilation script build.sh file, plus one line of code: AUTORECONF-IVF, as follows:


Recompile the entire Alsa-lib library.

2): duplicate-defined errors such as ' Atomic_add '

If you encounter this problem in the compilation, you need to modify the Configure and Configure.ac files, and if there are no such errors, you do not need to modify them. As shown below:


You need to remove the-d__arm__, then recompile the entire Alsa-lib library ...

3):--with-versioned's Problem

This problem is the hardest to find, but without--with-versioned=no, a static library call Snd_pcm_hw_params_get_buffer_size (X,X) can return the buffer_size size correctly. The dynamic library does not return correctly, and it always returns 0. I've been checking this place for two days to find out what's causing the problem here.


Four: Alsalib Library Migration Summary

There have been a lot of situations during the transplant, but it's also a learning opportunity, but fortunately the problem is all found and solved.

Embedded Linux ALSA audio architecture alsa-lib porting and compiling experience

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.