Android alsa problem

224 views
Skip to first unread message

xujh

unread,
Jul 26, 2009, 2:14:56 AM7/26/09
to android-porting
I have been troubled by alsa sound problem for several days .
I have got alsa using
git clone git://android.git.kernel.org/platform/hardware/alsa_sound.git
git clone git://android.git.kernel.org/platform/external/alsa-lib.git
git clone git://android.git.kernel.org/platform/external/alsa-utils.git
and modified BoardConfig.mk for it.
then i build .
when it boot up ,i ran alsa_aplay it said :
aplay: main:590: audio open error: Device or resource busy

and when i played music using ui ,the logcat messages repeated as
follows:
MXC : audio_stop_dma active = 0
E/ALSALib ( 1614): external/alsa-lib/src/pcm/pcm.c:7231:
(snd_pcm_recover) underrun occured
i don't know what happened,can anyone help me ? thanks!

my soundcard is WM9713 and my asound.conf is as below
## Mixer Devices

ctl.AndroidPlayback {
type hw
card 0
}

ctl.AndroidRecord {
type hw
card 0
}

## Playback Devices

pcm.AndroidPlayback {
type hooks
slave.pcm {
type hw
card 0
device 0 # Must be of type "digital audio
playback"
}
hooks.0 {
type ctl_elems
hook_args [
# Enable audio output from headset
{
name "Speaker Function"
lock true
preserve true
optional false
value off
}
]
}
}

pcm.AndroidPlayback_Speaker {
type hooks
slave.pcm {
type hw
card 0
device 0 # Must be of type "digital audio
playback"
}
hooks.0 {
type ctl_elems
hook_args [
{
name "Speaker Function"
lock true
preserve true
optional false
value on
}
]
}

}

pcm.AndroidPlayback_Speaker_normal {
type hooks
slave.pcm {
type hw
card 0
device 0 # Must be of type "digital audio
playback"
}
hooks.0 {
type ctl_elems
hook_args [
{
name "Speaker Function"
lock true
preserve true
optional false
value on
}
]
}

}

pcm.AndroidPlayback_Headset {
type hooks
slave.pcm {
type hw
card 0
device 0 # Must be of type "digital audio
playback"
}
hooks.0 {
type ctl_elems
hook_args [
# Enable audio output from headset
{
name "Speaker Function"
lock true
preserve true
optional false
value off
}
]
}

}

pcm.AndroidPlayback_Earpiece {
type null
}

# No bluetooth available. Send output to the bit bucket.
pcm.AndroidPlayback_Bluetooth {
type null

}

##
## Recording device
##

pcm.AndroidRecord_hook {
type hooks
slave {
pcm "hw:0,0"
}
hooks.0 {
type ctl_elems
hook_args [
{
# IMX3STACK values for capture source:
name "Capture Volume"
lock false
preserve true
optional false
value [15 15]
}
{
name "MIC GAIN"
lock false
preserve true
optional true
value 0
}
]
}
}

pcm.AndroidRecord_Speaker_normal_32000{
type rate
slave{
pcm "AndroidRecord_hook"
rate 32000
}
converter "linear"
}

pcm.AndroidRecord_Speaker_normal_44100{
type rate
slave{
pcm "AndroidRecord_hook"
rate 44100
}
converter "linear"
}

pcm.AndroidRecord_Speaker_normal_48000{
type rate
slave{
pcm "AndroidRecord_hook"
rate 48000
}
converter "linear"
}


pcm.AndroidRecord_Headset_normal_32000{
type rate
slave{
pcm "AndroidRecord_hook"
rate 32000
}
converter "linear"
}

pcm.AndroidRecord_Headset_normal_44100{
type rate
slave{
pcm "AndroidRecord_hook"
rate 44100
}
converter "linear"
}

pcm.AndroidRecord_Headset_normal_48000{
type rate
slave{
pcm "AndroidRecord_hook"
rate 48000
}
converter "linear"
}



xujh

unread,
Jul 26, 2009, 2:17:54 AM7/26/09
to android-porting


BTW:I ported android in iMX27 board.
and i ran alsa_amixer -v
# alsa_amixer -v
amixer version 1.0.19

Yi Sun

unread,
Jul 26, 2009, 11:52:13 AM7/26/09
to android...@googlegroups.com
You can take a look at the android-x86 source tree, it has sound works on almost all the EEEpc platforms and even virtual machines.
Yi
--
Android-x86
http://code.google.com/p/android-x86/

xujh

unread,
Jul 27, 2009, 11:07:50 PM7/27/09
to android-porting
I have seen the source tree about android-x86.I found that there is
vendor/asus folder and my board is freescale MX27,and i don't have a
vendor folder .Can i use the vendor/asus folder straightly ?

Yi Sun

unread,
Jul 28, 2009, 12:20:26 AM7/28/09
to android...@googlegroups.com

xujh

unread,
Jul 28, 2009, 10:53:02 PM7/28/09
to android-porting
solved! Thank you,hiahia

Neil Nguyen

unread,
Jul 28, 2009, 10:55:43 PM7/28/09
to android...@googlegroups.com

Can you please post your solution?
Thank you.

--- On Tue, 7/28/09, xujh <xjh4...@gmail.com> wrote:

> From: xujh <xjh4...@gmail.com>
> Subject: [android-porting] Re: Android alsa problem
> To: "android-porting" <android...@googlegroups.com>
> Date: Tuesday, July 28, 2009, 10:53 PM
>
> solved! Thank you,hiahia
> >
>



xujh

unread,
Jul 29, 2009, 4:08:32 AM7/29/09
to android-porting
I downloaded Alsa sounrce code:
then modified /mydroid/build/target/board/generic/BoardConfig.mk as
follows:
BOARD_USES_GENERIC_AUDIO := false
HAVE_HTC_AUDIO_DRIVER := false
BOARD_USES_ALSA_AUDIO := true
BUILD_WITH_ALSA_UTILS=true
in order to get /dev/snd* i modified mydroid/system/core/init/
devices.c according to
https://review.source.android.com/#change,4432

that's all!
AND i don't have an asound.conf .
BTW,I changed buffer size to 768 in /home/xujh/mydroid/hardware/
alsa_sound/AudioHardwareALSA.cpp so that it fits my board which is
iMX27.

WISH it will help!

Rama Meka

unread,
Jul 28, 2009, 11:37:29 PM7/28/09
to android...@googlegroups.com


On Wed, Jul 29, 2009 at 11:53 AM, xujh <xjh4...@gmail.com> wrote:

solved! Thank you,hiahia
I have got the similar problem with ALSA lib (underrun).  could you please post your solution? thanks.

 

Neil Nguyen

unread,
Jul 29, 2009, 8:05:28 PM7/29/09
to android...@googlegroups.com

Thanks for the information my friend.
It works now for me. One strange thing is that I have to do "make clean" and then "make" again. Anyhow, it is OK now for me. Thanks again.
Cheers,
Neil


--- On Wed, 7/29/09, xujh <xjh4...@gmail.com> wrote:

> From: xujh <xjh4...@gmail.com>
> Subject: [android-porting] Re: Android alsa problem
> To: "android-porting" <android...@googlegroups.com>
Reply all
Reply to author
Forward
0 new messages