1.å¦ä½å¨android ä¸ç¼è¯alsa-utilså·¥å
·
å¦ä½å¨android ä¸ç¼è¯alsa-utilså·¥å ·
ããæè¿å¨çALSA çdriverï¼å°è¯äºå¨android ä¸ç¼è¯alsa-utilså·¥å ·ï¼ä¸é¢è®²è¿°ä¸ï¼ææ¯å¦ä½è¿è¡ç¼è¯ä»¥åè¿ç¨ä¸éå°çé®é¢å¦ä½è§£å³çï¼
ããé¦å æä»ALSA å®æ¹ç½ä¸ä¸è½½äºalsa-utils-1.0.çæ¬çå·¥å ·ï¼å 为æandroid çalsa-lib ä¹æ¯1.çæ¬çï¼é²æ¢çæ¬ä¸ä¸æ ·åºç°é®é¢ï¼æå°±éæ©äºçæ¬ä¸æ ·ï¼æ们çalsa-libæ¾çè·¯å¾æ¯å¨android_source/external/alsa-libç®å½ä¸é¢ï¼æ们ä¸è½½çalsa-utils-1.å·¥å ·å ä¹ä¸è½½æ¾å¨éé¢ã
ããæ¥ä¸æ¥æ们éè¦å®æ以ä¸å 个å¨ä½ï¼
ãã1ãå¨alsa-utilsä¸é¢å建ä¸ä¸ªAndroid.mk
ããåçå 容æ¯ï¼
ããifeq ($(strip $(BOARD_USES_ALSA_AUDIO)),源码开心神兽源码true)
ããLOCAL_PATH:= $(call my-dir)
ãã#
ãã# Build aplay command
ãã#
ããinclude $(CLEAR_VARS)
ããLOCAL_CFLAGS := \
ãã-fPIC -D_POSIX_SOURCE \
ãã-DALSA_CONFIG_DIR=\"/system/usr/share/alsa\" \
ãã-DALSA_PLUGIN_DIR=\"/system/usr/lib/alsa-lib\" \
ãã-DALSA_DEVICE_DIRECTORY=\"/dev/snd/\"
ããLOCAL_C_INCLUDES:= \
ãã$(LOCAL_PATH)/include \
ãã$(LOCAL_PATH)/android \
ããexternal/alsa-lib/include
ããLOCAL_SRC_FILES := \
ããaplay/aplay.c
ããLOCAL_MODULE_TAGS := debug
ããLOCAL_MODULE := alsa_aplay
ããLOCAL_SHARED_LIBRARIES := \
ããlibasound \
ããlibc
ããinclude $(BUILD_EXECUTABLE)
ãã3ãè¿å ¥ç¬¬2æ¥ä¸å建çsysç®å½ï¼å¨sysç®å½ä¸å建signal.h头æ件ï¼å¨è¿ä¸ªå¤´æ件ä¸åå¦ä»¥ä¸å 容
ãã[plain] view plaincopyprint?
ãã.#include <signal.h>
ãã#include <signal.h>4ãæ¥ä¸æ¥ä½ ç´æ¥ç¼è¯android å°±å¯ä»¥äºï¼å¨ç¼è¯è¿ç¨ä¸å¯è½åºç°ä»¥ä¸ é误â
ãã4.1:kernel/common/linux/un.h:: error: expected specifier-qualifier-list before 'sa_family_t
ããé£æ¯å 为æ们å¨alsa-utils/alsactl/init_parse.céé¢å¨include un.hä¹å没æ#include <sys/socket.h>ï¼ä½ åªè¦å¨è¿ä¹åincludeè¿ä¸ªå¤´æ件就解å³äº
ãã4.2ï¼è¿æå¯è½éå°è¿ä¸ªé误ï¼å¨aplay.céé¢ä¼æ示æ¥é'S_IRGRP' undeclared (first use in this functionï¼ä½ åªè¦å¨å¨aplay.céé¢æ·»å ä¸ä¸ªå¤´æ件ï¼#include <sys/stat.h>,è¿æ ·å°±è§£å³äº
ãã4.3:æ¥ä¸æ¥å¯è½è¯è¨å°è¿æ ·çé误ï¼speaker-test.céé¢æ¥wav_file_dir没æå®ä¹ï¼è¿ä¸ªå¼æ¯ç¨æ¥å®ä¹ä½ çwavæ件åæ¾å¨padä¸çä½ç½®çï¼ä½ é便æ¾å¨åªéï¼æå®ä¹çè·¯å¾ å°±æ¯å¨/sdcardç®å½ä¸é¢
ããç»è¿ä¸é¢çç§ç§ä¿®æ¹ï¼alsa-utilså·¥å ·ç»äºç¼è¯æåäº
ãã
ãã以ä¸å°±æ¯æå¨ç¼è¯è¿ç¨ä¸çéå°çé®é¢
ãã转载