This generic AIDL audio HAL is designed to be easily adaptable to different platforms (Amlogic, Rockchip, etc.). It is based on the AOSP reference implementation and has been modified to offer more flexibility.
The HAL supports multiple audio modules:
- Primary/ALSA: Main module using ALSA for basic audio
- USB: USB audio device support
- Bluetooth: Bluetooth headset and speaker support
- R_submix: System audio capture (remote submix)
- Stub: Test/development module
To adapt this HAL to your specific platform:
-
Audio policy configuration:
- Create audio_policy_configuration.xml according to your hardware
- Define your audio devices, ports, and routes
-
ALSA configuration:
- Configure ALSA card and device numbers via system properties
- Create mixer_controls.xml with your ALSA mixer control names
-
Optional modules:
- Enable/disable modules in the VINTF manifest as needed
- Comment out unused modules in android.hardware.audio.service-aidl.baylibre.xml
The HAL can be configured via system properties:
# ALSA card and device selection
persist.vendor.audio.primary.card=0
persist.vendor.audio.primary.device=0
# Mixer controls configuration file
persist.vendor.audio.mixer.config=/vendor/etc/mixer_controls.xmlIn your platform's device.mk:
# Include BayLibre Audio HAL
PRODUCT_PACKAGES += \
com.android.hardware.audio.baylibre
# Copy platform-specific mixer controls configuration
PRODUCT_COPY_FILES += \
device/yourvendor/yourdevice/audio/mixer_controls.xml:$(TARGET_COPY_OUT_VENDOR)/etc/mixer_controls.xml
# Set system properties
PRODUCT_PROPERTY_OVERRIDES += \
persist.vendor.audio.primary.card=0main.cpp: Audio service entry pointModule.cpp: Main audio module implementationalsa/: Generic ALSA implementationbluetooth/: Bluetooth supportusb/: USB audio supportprimary/: Primary audio moduler_submix/: Remote submixstub/: Stub module for testingconfig/: XML configuration files*Effect*/: Audio effect implementations
- Create an audio policy configuration XML for your platform
- Create a mixer_controls.xml with your ALSA control names
- Set system properties for ALSA card/device if not 0
- Build the HAL with your configuration
- Test with
adb shell dumpsys media.audio_policy
See CONFIGURATION.md for detailed configuration instructions.
See PORTING.md for step-by-step platform porting instructions.
See MIXER_CONTROLS.md for details on ALSA mixer control management.
For questions or contributions, contact the BayLibre team.