1 <html devsite> 2 <head> 3 <title>Audio Implementation</title> 4 <meta name="project_path" value="/_project.yaml" /> 5 <meta name="book_path" value="/_book.yaml" /> 6 </head> 7 <body> 8 <!-- 9 Copyright 2017 The Android Open Source Project 10 11 Licensed under the Apache License, Version 2.0 (the "License"); 12 you may not use this file except in compliance with the License. 13 You may obtain a copy of the License at 14 15 http://www.apache.org/licenses/LICENSE-2.0 16 17 Unless required by applicable law or agreed to in writing, software 18 distributed under the License is distributed on an "AS IS" BASIS, 19 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 See the License for the specific language governing permissions and 21 limitations under the License. 22 --> 23 24 25 26 <p>This section explains how to implement the audio Hardware Abstraction Layer 27 (HAL), provides details about configuring an audio policy (file formats, code 28 organization, pre-processing effects), and describes how to configure the shared 29 library (creating the <code>Android.mk</code> file).</p> 30 31 <h2 id=implementing>Implementing the audio HAL</h2> 32 33 <p>The audio HAL is composed of the following interfaces:</p> 34 35 <ul> 36 <li><code>hardware/libhardware/include/hardware/audio.h</code>. Represents the 37 main functions of an audio device.</li> 38 <li><code>hardware/libhardware/include/hardware/audio_effect.h</code>. 39 Represents effects that can be applied to audio such as downmixing, echo, or 40 noise suppression.</li> 41 </ul> 42 43 <p>You must implement all interfaces.</p> 44 45 <h2 id=headers>Audio header files</h2> 46 <p>For a reference of the properties you can define, refer to the audio header 47 files:</p> 48 49 <ul> 50 <li>In Android 6.0 and higher, see 51 <code>system/media/audio/include/system/audio.h</code>.</li> 52 <li>In Android 5.1 and lower, see 53 <code>system/core/include/system/audio.h</code>.</li> 54 </ul> 55 56 <p>For an example, refer to the implementation for the Galaxy Nexus at 57 <code>device/samsung/tuna/audio</code>.</p> 58 59 <h2 id=next-steps>Next steps</h2> 60 61 <p>In addition to implementing the audio HAL, you must also create an 62 <a href="/devices/audio/implement-policy.html">audio policy 63 configuration file</a> that describes your audio topology and package the HAL 64 implementation into a 65 <a href="/devices/audio/implement-shared-library.html">shared 66 library</a>. You can also configure 67 <a href="/devices/audio/implement-pre-processing.html">pre-processing 68 effects</a> such as automatic gain control and noise suppression.</p> 69 70 </body> 71 </html> 72