blob: 1b85d5e0e14c85db7287c456c580d884ffe9119f [file] [log] [blame]
Robert Ly35f2fda2013-01-29 16:27:05 -08001page.title=Audio
2@jd:body
3
4<!--
Clay Murphy768b82a2013-11-12 11:32:41 -08005 Copyright 2013 The Android Open Source Project
Robert Ly35f2fda2013-01-29 16:27:05 -08006
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-->
Robert Ly35f2fda2013-01-29 16:27:05 -080019<p>
Clay Murphyc28f2372013-09-25 16:13:40 -070020 Android's audio Hardware Abstraction Layer (HAL) connects the higher level, audio-specific
Robert Ly35f2fda2013-01-29 16:27:05 -080021 framework APIs in <a href="http://developer.android.com/reference/android/media/package-summary.html">android.media</a>
22 to the underlying audio driver and hardware.
23</p>
24
25<p>
26 The following figure and list describe how audio functionality is implemented and the relevant
27 source code that is involved in the implementation:
28</p>
29<p>
Glenn Kasten3dbc8042014-02-04 09:58:32 -080030 <img src="images/audio_hal.png" alt="Audio architecture" />
Robert Ly35f2fda2013-01-29 16:27:05 -080031</p>
32<dl>
33 <dt>
34 Application framework
35 </dt>
36 <dd>
37 At the application framework level is the app code, which utilizes the
38 <a href="http://developer.android.com/reference/android/media/package-summary.html">android.media</a>
39 APIs to interact with the audio hardware. Internally, this code calls corresponding JNI glue
Clay Murphyc28f2372013-09-25 16:13:40 -070040 classes to access the native code that interacts with the audio hardware.
Robert Ly35f2fda2013-01-29 16:27:05 -080041 </dd>
42 <dt>
43 JNI
44 </dt>
45 <dd>
46 The JNI code associated with <a href="http://developer.android.com/reference/android/media/package-summary.html">android.media</a> is located in the
47 <code>frameworks/base/core/jni/</code> and <code>frameworks/base/media/jni</code> directories.
48 This code calls the lower level native code to obtain access to the audio hardware.
49 </dd>
50 <dt>
51 Native framework
52 </dt>
53 <dd>
54 The native framework is defined in <code>frameworks/av/media/libmedia</code> and provides a
55 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
56 IPC proxies to obtain access to audio-specific services of the media server.
57 </dd>
58 <dt>
59 Binder IPC
60 </dt>
61 <dd>
62 The Binder IPC proxies facilitate communication over process boundaries. They are located in
63 the <code>frameworks/av/media/libmedia</code> directory and begin with the letter "I".
64 </dd>
65 <dt>
66 Media Server
67 </dt>
68 <dd>
69 The audio services in the media server, located in
70 <code>frameworks/av/services/audioflinger</code>, is the actual code that interacts with your
71 HAL implementations.
72 </dd>
73 <dt>
74 HAL
75 </dt>
76 <dd>
Clay Murphyc28f2372013-09-25 16:13:40 -070077 The HAL defines the standard interface that audio services call into
Robert Ly35f2fda2013-01-29 16:27:05 -080078 and that you must implement to have your audio hardware function correctly. The audio HAL
Clay Murphyc28f2372013-09-25 16:13:40 -070079 interfaces are located in
80<code>hardware/libhardware/include/hardware</code>. See <a
81href="http://source.android.com/devices/reference/audio_8h_source.html">audio.h</a> for additional details.
Robert Ly35f2fda2013-01-29 16:27:05 -080082 </dd>
83 <dt>
84 Kernel Driver
85 </dt>
86 <dd>
87 The audio driver interacts with the hardware and your implementation of the HAL. You can choose
88 to use ALSA, OSS, or a custom driver of your own at this level. The HAL is driver-agnostic.
89 <p>
90 <strong>Note:</strong> If you do choose ALSA, we recommend using <code>external/tinyalsa</code>
91 for the user portion of the driver because of its compatible licensing (The standard user-mode
92 library is GPL licensed).
93</p>
94 </dd>
95</dl>
Clay Murphy47b1d3f2013-10-03 10:02:22 -070096
Robert Ly35f2fda2013-01-29 16:27:05 -080097<p>
Clay Murphy47b1d3f2013-10-03 10:02:22 -070098 See the rest of the pages within the Audio section for implementation
99 instructions and ways to improve performance.
Robert Ly35f2fda2013-01-29 16:27:05 -0800100</p>