ALSA-lib cross-compilation and sound card driver testing (conversion)

Source: Internet
Author: User

L download ALSA-utils and ALSA-Lib in the same version.

Http://www.alsa-project.org/main/index.php/Download

 

L compile ALSA-lib

./Configure -- Host = arm-None-Linux-gnueabi -- disable-Python -- prefix =/usr/share/ARM-ALSA/

 

If the following error message is displayed, -- disable-pyhont

Collect2: LD returned 1 exit status

Make [3]: *** [smixer-python.la] Error 1

Make [3]: Leaving directory '/home/Enzo/work/tq2440/ALSA/alsa-lib-1.0.26/

Modules/mixer/simple'

Make [2]: *** [All-recursive] Error 1

Make [2]: Leaving directory '/home/Enzo/work/tq2440/ALSA/alsa-lib-1.0.26/

Modules/mixer'

Make [1]: *** [All-recursive] Error 1

Make [1]: Leaving directory '/home/Enzo/work/tq2440/ALSA/alsa-lib-1.0.26/

Modules'

 

-- With-ALSA-inc-prefix and -- With-ALSA-Prefix specify the header files and library files required for cross-compiling util applications; -- disable-alsamixer indicates that the application alsamixer is not compiled and generated because the program depends on the graph interface library ncurses. Currently, we cannot cross-compile the library, so we discard it.

 

 

Change to root identity

# Sudo Su

ALSA-lib also requires cross-compilation in make install. Therefore, you must add the path of the Cross-compiler to the path environment variable.

# Export Path = $ path:/usr/local/ARM/4.3.2/bin & make install

 

L compile ALSA-utils

. /Configure -- Host = arm-None-Linux-gnueabi -- prefix =/usr/share/ARM-ALSA/-- With-ALSA-inc-Prefix =/usr/share/ARM- ALSA/include -- With-ALSA-Prefix =/usr/share/ARM-ALSA/lib -- disable-xmlto -- disable-alsamixer

 

L copy ALSA-lib and ALSA-utils TO THE DEVELOPMENT BOARD

The copy path of the Development Board is not set randomly and must be the same as the path when the host is compiled. Otherwise, some files cannot be found in the dynamic library.

 

Therefore, copy the content in the/usr/share/ARM-ALSA folder to the Development Board/usr/share/ARM-ALSA.

 

Copy ALSA lib to the Development Board/lib folder.

 

 

The/dev directory already contains the device.

/Dev/controlc0,/dev/pcmc0d0p,/dev/pcmc0d0c,/dev/mixer,/dev/Timer

[[Email protected]/] # ls/dev/PCM *

/Dev/pcmc0d0c/dev/pcmc0d0p

[[Email protected]/] # ls/dev/con *

/Dev/console/dev/controlc0

[[Email protected]/] # ls/dev/mix *

/Dev/mice/dev/Mixer

[[Email protected]/] # ls/dev/Tim *

/Dev/Timer

 

Test the aplay Program

[[Email protected] bin] #./aplay test1.wav

ALSA lib confmisc. C: 768 :( parse_card) cannot find card '0'

ALSA lib Conf. C: 4246 :( _ snd_config_evaluate) function snd_func_card_driver returned error: no such file or directory

ALSA lib confmisc. C: 392 :( snd_func_concat) error evaluating strings

ALSA lib Conf. C: 4246 :( _ snd_config_evaluate) function snd_func_concat returned error: no such file or directory

ALSA lib confmisc. C: 1251 :( snd_func_refer) error evaluating name

ALSA lib Conf. C: 4246 :( _ snd_config_evaluate) function snd_func_refer returned error: no such file or directory

ALSA lib Conf. C: 4725 :( snd_config_expand) Evaluate error: no such file or directory

ALSA lib PCM. C: 2217 :( snd_pcm_open_noupdate) unknown PCM default

Aplay: Main: 696: audio open error: no such file or directory

 

Create a sound card node to/dev/snd/

Manually create a node

 

If [! -D/dev/snd/]; then

Echo "make snd node ."

Mkdir/dev/SND

Ln-S/dev/pcmc0d0c/dev/snd/pcmc0d0c

Ln-S/dev/pcmc0d0p/dev/snd/pcmc0d0p

Ln-S/dev/Timer/dev/snd/Timer

Ln-S/dev/controlc0/dev/snd/controlc0

Ln-S/dev/mixer/dev/snd/Mixer

Fi

Export Path = $ path:/usr/share/ARM-ALSA/bin

Export alsa_config_path =/usr/share/ARM-ALSA/share/ALSA. conf

 

# Volumn set the sound size

Amixer cset numid = 1 45

After Successful Configuration

 

L ALSA sound card configuration

** The Alsa sound card works properly and is set in amixer.

 

*** Usage of amixer

# Amixer cset numid = N value // sets the variable. numid corresponds to the contents ID.

# Amixer cget numid = N // get a setting of amixer

 

[Root @ embedsky/mnt] # amixer Contents

Numid = 1, iface = mixer, name = 'master playback volume'

; Type = integer, access = RW ------, values = 1, min = 0, max = 63, step = 0

: Values = 50

Numid = 7, iface = mixer, name = 'tone control-bass'

; Type = integer, access = RW ------, values = 1, min = 0, max = 15, step = 0

: Values = 0

Numid = 8, iface = mixer, name = 'tone control-treble'

; Type = integer, access = RW ------, values = 1, min = 0, max = 3, step = 0

: Values = 0

Numid = 10, iface = mixer, name = 'PCM playback de-emphasis'

; Type = enumerated, access = RW ------, values = 1, items = 4

; Item #0 'none'

; Item #1 '32khz'

; Item #2 '44. 1khz'

; Item #3 '48 kHz'

: Values = 0

Numid = 5, iface = mixer, name = 'mic sensitification'

; Type = integer, access = RW ------, values = 1, min = 0, max = 7, step = 0

: Values = 1

Numid = 6, iface = mixer, name = 'mic volume'

; Type = integer, access = RW ------, values = 1, min = 0, max = 31, step = 0

: Values = 0

Numid = 16, iface = mixer, name = 'adc + 6db Switch'

; Type = Boolean, access = RW ------, values = 1

: Values = off

Numid = 17, iface = mixer, name = 'adc polarity switch'

; Type = Boolean, access = RW ------, values = 1

: Values = off

Numid = 2, iface = mixer, name = 'capture volume'

; Type = integer, access = RW ------, values = 1, min = 0, max = 7, step = 0

: Values = 1

Numid = 12, iface = mixer, name = 'agc switch'

; Type = Boolean, access = RW ------, values = 1

: Values = off

Numid = 13, iface = mixer, name = 'agc target volume'

; Type = integer, access = RW ------, values = 1, min = 0, max = 3, step = 0

: Values = 3

Numid = 14, iface = mixer, name = 'agc timing'

; Type = integer, access = RW ------, values = 1, min = 0, max = 7, step = 0

: Values = 0

Numid = 3, iface = mixer, name = 'analog1 volume'

; Type = integer, access = RW ------, values = 1, min = 0, max = 31, step = 0

: Values = 27

Numid = 4, iface = mixer, name = 'analog2 volume'

; Type = integer, access = RW ------, values = 1, min = 0, max = 31, step = 0

: Values = 27

Numid = 15, iface = mixer, name = 'dac + 6db Switch'

; Type = Boolean, access = RW ------, values = 1

: Values = off

Numid = 18, iface = mixer, name = 'dac polarity switch'

; Type = Boolean, access = RW ------, values = 1

: Values = off

Numid = 20, iface = mixer, name = 'DC filter enable switch'

; Type = Boolean, access = RW ------, values = 1

: Values = off

Numid = 19, iface = mixer, name = 'double speed playback switch'

; Type = Boolean, access = RW ------, values = 1

: Values = off

Numid = 11, iface = mixer, name = 'input MUX'

; Type = enumerated, access = RW ------, values = 1, items = 4

; Item #0 'differential'

; Item #1 'analog1'

; Item #2 'analog2'

; Item #3 'both'

: Values = 0

Numid = 9, iface = mixer, name = 'sound processing filter'

; Type = enumerated, access = RW ------, values = 1, items = 4

; Item #0 'Flat'

; Item #1 'minimum1'

; Item #2 'minimum2'

; Item #3 'maximum'

: Values = 0

 

L sound card test

** Playback

[Root @ embedsky/mnt] # aplay sound_check.wav

Playing wave 'sound_check.wav ': signed 16 Bit little endian, rate 44100Hz, stereo

** Recording

Playback command

Arecord-D 1-T wav-C2-r 8000-F s16_le test1.wav

Arecord-D 60-T wav-C2-r 8000-F s16_le test1.wav

 

-D recording time, in seconds

-Number of C Channels

-R sampling frequency

-F sampling format, 16-bit small end

 

 

** Simultaneous recording during playback

 

1. enable two terminals respectively. One of them is playing and the playing sound is not intermittently abnormal.

Aplay sound_check.wav

Another random recording

Arecord-D 3-T wav-C2-r 8000-F s16_le test1.wav

 

2. The recording lasts for 1 minute. Another terminal plays the video at random and then listens to the recorded file without any noise, interruptions or exceptions.

Arecord-D 60-T wav-C2-r 8000-F s16_le test1.wav

 

Aplay test1.wav

 

** Whether the dual-channel recording is normal after playback (not tested)

 

** Cross-compile other programs:
Add writable ded file in program: # include <ALSA/asoundlib. h>
~ # Arm-None-Linux-gnueabi-gcc-lasound-L/usr/share/ARM-ALSA/lib/-I/usr/share/ARM-ALSA/include/-o test my_test.c

ALSA-lib cross-compilation and sound card driver testing (conversion)

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.