blob: 31e795b0ade3f7aca28cba0a8ed375c6adb3554c [file] [log] [blame]
Glenn Kasten2956d762015-05-21 13:03:22 -07001page.title=Audio Implementation
Clay Murphy47b1d3f2013-10-03 10:02:22 -07002@jd:body
3
4<!--
Rom Lemarchand44dda732015-04-03 15:10:10 -07005 Copyright 2015 The Android Open Source Project
Clay Murphy47b1d3f2013-10-03 10:02:22 -07006
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
Heidi von Markhamd0333d62016-07-08 12:05:46 -070027<p>This section explains how to implement the audio Hardware Abstraction Layer
28(HAL), provides details about configuring an audio policy (file formats, code
29organization, pre-processing effects), and describes how to configure the shared
30library (creating the <code>Android.mk</code> file).</p>
Clay Murphy47b1d3f2013-10-03 10:02:22 -070031
Heidi von Markhamd0333d62016-07-08 12:05:46 -070032<h2 id=implementing>Implementing the audio HAL</h2>
Heidi Miller54362a62014-10-24 16:00:04 -070033
Heidi von Markhamd0333d62016-07-08 12:05:46 -070034<p>The audio HAL is composed of the following interfaces:</p>
Heidi Miller54362a62014-10-24 16:00:04 -070035
Clay Murphy47b1d3f2013-10-03 10:02:22 -070036<ul>
Heidi von Markhamd0333d62016-07-08 12:05:46 -070037<li><code>hardware/libhardware/include/hardware/audio.h</code>. Represents the
38main functions of an audio device.</li>
39<li><code>hardware/libhardware/include/hardware/audio_effect.h</code>.
40Represents effects that can be applied to audio such as downmixing, echo, or
41noise suppression.</li>
42</ul>
43
44<p>You must implement all interfaces.</p>
45
46<h2 id=headers>Audio header files</h2>
47<p>For a reference of the properties you can define, refer to the audio header
48files:</p>
49
50<ul>
51<li>In Android 6.0 and higher, see
52<code>system/media/audio/include/system/audio.h</code>.</li>
53<li>In Android 5.1 and lower, see
54<code>system/core/include/system/audio.h</code>.</li>
Clay Murphy47b1d3f2013-10-03 10:02:22 -070055</ul>
Heidi Miller54362a62014-10-24 16:00:04 -070056
57<p>For an example, refer to the implementation for the Galaxy Nexus at
58<code>device/samsung/tuna/audio</code>.</p>
Clay Murphy47b1d3f2013-10-03 10:02:22 -070059
Heidi von Markhamd0333d62016-07-08 12:05:46 -070060<h2 id=next-steps>Next steps</h2>
Rom Lemarchand44dda732015-04-03 15:10:10 -070061
Heidi von Markhamd0333d62016-07-08 12:05:46 -070062<p>In addition to implementing the audio HAL, you must also create an
63<a href="{@docRoot}devices/audio/implement-policy.html">audio policy
64configuration file</a> that describes your audio topology and package the HAL
65implementation into a
66<a href="{@docRoot}devices/audio/implement-shared-library.html">shared
67library</a>. You can also configure
68<a href="{@docRoot}devices/audio/implement-pre-processing.html">pre-processing
69effects</a> such as automatic gain control and noise suppression.</p>