blob: e82788f630ecc7792cb8febdfc80a88949afc711 [file] [log] [blame]
Dan Morrill3cd199f2009-11-06 14:04:16 -08001page.title=Audio
2pdk.version=1.0
3doc.type=porting
4@jd:body
5
6<div id="qv-wrapper">
7<div id="qv">
8<h2>In this document</h2>
9<a name="toc"/>
10<ul>
11<li><a href="#androidAudioBuildingDriver">Building an Audio Library</a></li>
12<li><a href="#androidAudioInterface">Interface</a></li>
13</ul>
14</div>
15</div>
16
17
18<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>
19<p><img src="images/android_audio_architecture.gif"></p>
20
21Solid elements represent Android blocks and dashed elements represent partner-specific blocks.
22
23
24
25<a name="androidAudioBuildingDriver"></a><h3>Building an Audio Library</h3>
26
27<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>vendor/acme/chipset_or_board/libaudio/</code>.</p>
28<p>The following stub <code>Android.mk</code> file ensures that <code>libaudio</code> compiles and links to the appropriate libraries:</p>
29
30<pre class="prettify">
31LOCAL_PATH := $(call my-dir)
32include $(CLEAR_VARS)
33
34LOCAL_MODULE := libaudio
35
36LOCAL_SHARED_LIBRARIES := \
37 libcutils \
38 libutils \
39 libmedia \
40 libhardware
41
42LOCAL_SRC_FILES += MyAudioHardware.cpp
43
44LOCAL_CFLAGS +=
45
46LOCAL_C_INCLUDES +=
47
48LOCAL_STATIC_LIBRARIES += libaudiointerface
49
50include $(BUILD_SHARED_LIBRARY)
51</pre>
52
53
54<a name="androidAudioInterface"></a><h3>Interface</h3>
55
56
57
58<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>
59
60
61<iframe onLoad="resizeDoxFrameHeight();" src="AudioHardwareInterface_8h.html" scrolling="no" scroll="no" id="doxygen" marginwidth="0" marginheight="0" frameborder="0" style="width:100%;"></iframe>