blob: 9f6338dac0f9499a7866924e75b9e7dad65962fd [file] [log] [blame]
Robert Ly35f2fda2013-01-29 16:27:05 -08001page.title=Audio
2@jd:body
3
4<!--
5 Copyright 2010 The Android Open Source Project
6
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
10
11 http://www.apache.org/licenses/LICENSE-2.0
12
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18-->
19<div id="qv-wrapper">
20 <div id="qv">
21 <h2>In this document</h2>
22 <ol id="auto-toc">
23 </ol>
24 </div>
25</div>
26
27<p>
Clay Murphyc28f2372013-09-25 16:13:40 -070028 Android's audio Hardware Abstraction Layer (HAL) connects the higher level, audio-specific
Robert Ly35f2fda2013-01-29 16:27:05 -080029 framework APIs in <a href="http://developer.android.com/reference/android/media/package-summary.html">android.media</a>
30 to the underlying audio driver and hardware.
31</p>
32
33<p>
34 The following figure and list describe how audio functionality is implemented and the relevant
35 source code that is involved in the implementation:
36</p>
37<p>
38 <img src="images/audio_hal.png">
39</p>
40<dl>
41 <dt>
42 Application framework
43 </dt>
44 <dd>
45 At the application framework level is the app code, which utilizes the
46 <a href="http://developer.android.com/reference/android/media/package-summary.html">android.media</a>
47 APIs to interact with the audio hardware. Internally, this code calls corresponding JNI glue
Clay Murphyc28f2372013-09-25 16:13:40 -070048 classes to access the native code that interacts with the audio hardware.
Robert Ly35f2fda2013-01-29 16:27:05 -080049 </dd>
50 <dt>
51 JNI
52 </dt>
53 <dd>
54 The JNI code associated with <a href="http://developer.android.com/reference/android/media/package-summary.html">android.media</a> is located in the
55 <code>frameworks/base/core/jni/</code> and <code>frameworks/base/media/jni</code> directories.
56 This code calls the lower level native code to obtain access to the audio hardware.
57 </dd>
58 <dt>
59 Native framework
60 </dt>
61 <dd>
62 The native framework is defined in <code>frameworks/av/media/libmedia</code> and provides a
63 native equivalent to the <a href="http://developer.android.com/reference/android/media/package-summary.html">android.media</a> package. The native framework calls the Binder
64 IPC proxies to obtain access to audio-specific services of the media server.
65 </dd>
66 <dt>
67 Binder IPC
68 </dt>
69 <dd>
70 The Binder IPC proxies facilitate communication over process boundaries. They are located in
71 the <code>frameworks/av/media/libmedia</code> directory and begin with the letter "I".
72 </dd>
73 <dt>
74 Media Server
75 </dt>
76 <dd>
77 The audio services in the media server, located in
78 <code>frameworks/av/services/audioflinger</code>, is the actual code that interacts with your
79 HAL implementations.
80 </dd>
81 <dt>
82 HAL
83 </dt>
84 <dd>
Clay Murphyc28f2372013-09-25 16:13:40 -070085 The HAL defines the standard interface that audio services call into
Robert Ly35f2fda2013-01-29 16:27:05 -080086 and that you must implement to have your audio hardware function correctly. The audio HAL
Clay Murphyc28f2372013-09-25 16:13:40 -070087 interfaces are located in
88<code>hardware/libhardware/include/hardware</code>. See <a
89href="http://source.android.com/devices/reference/audio_8h_source.html">audio.h</a> for additional details.
Robert Ly35f2fda2013-01-29 16:27:05 -080090 </dd>
91 <dt>
92 Kernel Driver
93 </dt>
94 <dd>
95 The audio driver interacts with the hardware and your implementation of the HAL. You can choose
96 to use ALSA, OSS, or a custom driver of your own at this level. The HAL is driver-agnostic.
97 <p>
98 <strong>Note:</strong> If you do choose ALSA, we recommend using <code>external/tinyalsa</code>
99 for the user portion of the driver because of its compatible licensing (The standard user-mode
100 library is GPL licensed).
101</p>
102 </dd>
103</dl>
Clay Murphy47b1d3f2013-10-03 10:02:22 -0700104
Robert Ly35f2fda2013-01-29 16:27:05 -0800105<p>
Clay Murphy47b1d3f2013-10-03 10:02:22 -0700106 See the rest of the pages within the Audio section for implementation
107 instructions and ways to improve performance.
Robert Ly35f2fda2013-01-29 16:27:05 -0800108</p>