The Android system supports ALSA but is not downloaded or compiled by default. Yes
Follow these steps to use ALSA in Android.
1. Use git to obtain the following three ALSA-related packages and place them in the corresponding location.
Git clone git: // android.git.kernel.org/platform/external/alsa-lib.git
Git clone git: // android.git.kernel.org/platform/external/alsa-utils.git
Git clone git: // android.git.kernel.org/platform/hardware/alsa_sound.git
2. Modify the boardconfig. mk file to add
Board_uses_alsa_audio: = true
Build_with_alsa_utils: = true
Then compile the three packages above.
3. Put the ALSA. conf file in the compiled system/etc/directory.
The basic content is as follows (the specific configuration depends on the audio codec used ):
CTL. androidplayback {
Type HW
Card 0
}
CTL. androidcapture {
Type HW
Card 0
}
PCM. androidplayback_speaker_normal {
Type hooks
Slave. PCM {
Type HW
Card 0
Device 1
}
Hooks.0 {
Type ctl_elems
Hook_args [
{
Name = 'mono mixer dac1 switch'
Value = true
}
{
Name = 'mono mixer dac2 switch'
Value = true
}
]
}
}
4. troubleshooting
If you are good at using alsa_amixer and alsa_aplay.