git clone git://android.git.kernel.org/platform/external/alsa-lib.git
git clone git://android.git.kernel.org/platform/external/alsa-utils.git
cd ../hardware
git clone git://android.git.kernel.org/platform/hardware/alsa_sound.git
2: 修改:build/target/board/generic/BoardConfig.mk 为如下
# config.mk
#
# Product-specific compile-time definitions.
#
# The generic product target doesn't have any hardware-specific pieces.
TARGET_NO_BOOTLOADER := true
TARGET_NO_KERNEL := true
TARGET_CPU_ABI := armeabi
#HAVE_HTC_AUDIO_DRIVER := true
BOARD_USES_ALSA_AUDIO := true
BUILD_WITH_ALSA_UTILS := true
BOARD_USES_GENERIC_AUDIO := false
# Set /system/bin/sh to mksh, not ash, to test the transition.
TARGET_SHELL := mksh
3:make clean
4:make -j2
5:修改 init.rc,在此文件中加入如下代码,注意,应该在比较靠前的地方。
# windsome modify audio
chown root audio /dev/snd/controlC0
chown root audio /dev/snd/pcmC0D0c
chown root audio /dev/snd/pcmC0D0p
chown root audio /dev/snd/timer
chmod 0666 /dev/snd/controlC0
chmod 0666 audio /dev/snd/pcmC0D0c
chmod 0666 audio /dev/snd/pcmC0D0p
chmod 0666 audio /dev/snd/timer
6:增加asound.conf 文件,并放入到system/etc/下。我是从网上抄的一个,稍微改改能用了,也没有仔细分析到底该怎么写。
# #
# # Mixer devices
# #
ctl.AndroidOut {
type hw
card 0
}
ctl.AndroidIn {
type hw
card 0
}
ctl.AndroidPlayback {
type hw
card 0 # Can replace with drivers name from /proc/asound/cards
}
ctl.AndroidRecord {
type hw
card 0
}
# #
# # Playback devices
# #
pcm.AndroidPlayback {
type hw
card 0
device 0
}
pcm.AndroidPlayback_Speaker {
type hw
card 0
device 0
}
pcm.AndroidPlayback_Speaker_normal {
type hw
card 0
device 0
}
pcm.AndroidPlayback_Speaker_ringtone {
type hw
card 0
device 0
}
pcm.AndroidPlayback_Speaker_incall {
type hw
card 0
device 0
}
pcm.AndroidPlayback_Earpiece {
type hw
card 0
device 0
}
pcm.AndroidPlayback_Earpiece_normal {
type hw
card 0
device 0
}
pcm.AndroidPlayback_Earpiece_ringtone {
type hw
card 0
device 0
}
pcm.AndroidPlayback_Earpiece_incall {
type hw
card 0
device 0
}
pcm.AndroidPlayback_Bluetooth {
type hw
card 0
device 0
}
pcm.AndroidPlayback_Bluetooth_normal {
type hw
card 0
device 0
}
pcm.AndroidPlayback_Bluetooth_ringtone {
type hw
card 0
device 0
}
pcm.AndroidPlayback_Bluetooth_incall {
type hw
card 0
device 0
}
pcm.AndroidPlayback_Headset {
type hw
card 0
device 0
}
pcm.AndroidPlayback_Headset_normal {
type hw
card 0
device 0
}
pcm.AndroidPlayback_Headset_ringtone {
type hw
card 0
device 0
}
pcm.AndroidPlayback_Headset_incall {
type hw
card 0
device 0
}
pcm.AndroidPlayback_Bluetooth-A2DP {
type hw
card 0
device 0
}
pcm.AndroidPlayback_Bluetooth-A2DP_normal {
type hw
card 0
device 0
}
pcm.AndroidPlayback_Bluetooth-A2DP_ringtone {
type hw
card 0
device 0
}
pcm.AndroidPlayback_Bluetooth-A2DP_incall {
type hw
card 0
device 0
}
pcm.AndroidRecord {
type hw
card 0
device 0
}
pcm.AndroidRecord_Microphone {
type hw
card 0
device 0
}