blob: fddb293e54a042ae2014ad8fa7e61180df4ec4c3 [file] [log] [blame]
David Warren5f6ca4f2009-04-30 17:11:58 -07001page.title=Audio
2pdk.version=1.0
3@jd:body
4
5<a name="toc"/>
6<div style="padding:10px">
7<a href="#androidAudioSubSystemIntroduction">Introduction</a><br/>
8<a href="#androidAudioBuildingDriver">Building an Audio Library</a><br/>
9<a href="#androidAudioInterface">Interface</a><br/></div></font>
10
11<a name="androidAudioSubSystemIntroduction"></a><h2>Introduction</h2>
12
13<p>AudioHardwareInterface serves as the glue between proprietary audio drivers and the Android AudioFlinger service, the core audio service that handles all audio-related requests from applications.</p>
14<p><img src="images/android_audio_architecture.gif"></p>
15
16Solid elements represent Android blocks and dashed elements represent partner-specific blocks.
17
18
19
20<a name="androidAudioBuildingDriver"></a><h2>Building an Audio Library</h2>
21
22<p>To implement an audio driver, create a shared library that implements the interface defined in <code>AudioHardwareInterface.h</code>. You must name your shared library <code>libaudio.so</code> so that it will get loaded from <code>/system/lib</code> at runtime. Place libaudio sources and <code>Android.mk</code> in <code>partner/acme/chipset_or_board/libaudio/</code>.</p>
23<p>The following stub <code>Android.mk</code> file ensures that <code>libaudio</code> compiles and links to the appropriate libraries:</p>
24
25<pre class="prettify">
26LOCAL_PATH := $(call my-dir)
27include $(CLEAR_VARS)
28
29LOCAL_MODULE := libaudio
30
31LOCAL_SHARED_LIBRARIES := \
32 libcutils \
33 libutils \
34 libmedia \
35 libhardware
36
37LOCAL_SRC_FILES += MyAudioHardware.cpp
38
39LOCAL_CFLAGS +=
40
41LOCAL_C_INCLUDES +=
42
43LOCAL_STATIC_LIBRARIES += libaudiointerface
44
45include $(BUILD_SHARED_LIBRARY)
46</pre>
47
48
49<a name="androidAudioInterface"></a><h2>Interface</h2>
50
51
52
53<p class="note"><strong>Note</strong>: This document relies on some Doxygen-generated content that appears in an iFrame below. To return to the Doxygen default content for this page, <a href="audio_sub_system.html">click here</a>.</p>
54
55
56<iframe onLoad="resizeDoxFrameHeight();" src="AudioHardwareInterface_8h.html" scrolling="no" scroll="no" id="doxygen" marginwidth="0" marginheight="0" frameborder="0" style="width:100%;"></iframe>