| <html devsite> |
| <head> |
| <title>Audio Implementation</title> |
| <meta name="project_path" value="/_project.yaml" /> |
| <meta name="book_path" value="/_book.yaml" /> |
| </head> |
| <body> |
| <!-- |
| Copyright 2017 The Android Open Source Project |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| |
| |
| |
| <p>This section explains how to implement the audio Hardware Abstraction Layer |
| (HAL), provides details about configuring an audio policy (file formats, code |
| organization, pre-processing effects), and describes how to configure the shared |
| library (creating the <code>Android.mk</code> file).</p> |
| |
| <h2 id=implementing>Implementing the audio HAL</h2> |
| |
| <p>The audio HAL is composed of the following interfaces:</p> |
| |
| <ul> |
| <li><code>hardware/libhardware/include/hardware/audio.h</code>. Represents the |
| main functions of an audio device.</li> |
| <li><code>hardware/libhardware/include/hardware/audio_effect.h</code>. |
| Represents effects that can be applied to audio such as downmixing, echo, or |
| noise suppression.</li> |
| </ul> |
| |
| <p>You must implement all interfaces.</p> |
| |
| <h2 id=headers>Audio header files</h2> |
| <p>For a reference of the properties you can define, refer to the audio header |
| files:</p> |
| |
| <ul> |
| <li>In Android 6.0 and higher, see |
| <code>system/media/audio/include/system/audio.h</code>.</li> |
| <li>In Android 5.1 and lower, see |
| <code>system/core/include/system/audio.h</code>.</li> |
| </ul> |
| |
| <p>For an example, refer to the implementation for the Galaxy Nexus at |
| <code>device/samsung/tuna/audio</code>.</p> |
| |
| <h2 id=next-steps>Next steps</h2> |
| |
| <p>In addition to implementing the audio HAL, you must also create an |
| <a href="/devices/audio/implement-policy.html">audio policy |
| configuration file</a> that describes your audio topology and package the HAL |
| implementation into a |
| <a href="/devices/audio/implement-shared-library.html">shared |
| library</a>. You can also configure |
| <a href="/devices/audio/implement-pre-processing.html">pre-processing |
| effects</a> such as automatic gain control and noise suppression.</p> |
| |
| </body> |
| </html> |