Glenn Kasten | 2956d76 | 2015-05-21 13:03:22 -0700 | [diff] [blame] | 1 | page.title=Audio Implementation |
Clay Murphy | 47b1d3f | 2013-10-03 10:02:22 -0700 | [diff] [blame] | 2 | @jd:body |
| 3 | |
| 4 | <!-- |
Rom Lemarchand | 44dda73 | 2015-04-03 15:10:10 -0700 | [diff] [blame] | 5 | Copyright 2015 The Android Open Source Project |
Clay Murphy | 47b1d3f | 2013-10-03 10:02:22 -0700 | [diff] [blame] | 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 | |
Heidi von Markham | d0333d6 | 2016-07-08 12:05:46 -0700 | [diff] [blame] | 27 | <p>This section explains how to implement the audio Hardware Abstraction Layer |
| 28 | (HAL), provides details about configuring an audio policy (file formats, code |
| 29 | organization, pre-processing effects), and describes how to configure the shared |
| 30 | library (creating the <code>Android.mk</code> file).</p> |
Clay Murphy | 47b1d3f | 2013-10-03 10:02:22 -0700 | [diff] [blame] | 31 | |
Heidi von Markham | d0333d6 | 2016-07-08 12:05:46 -0700 | [diff] [blame] | 32 | <h2 id=implementing>Implementing the audio HAL</h2> |
Heidi Miller | 54362a6 | 2014-10-24 16:00:04 -0700 | [diff] [blame] | 33 | |
Heidi von Markham | d0333d6 | 2016-07-08 12:05:46 -0700 | [diff] [blame] | 34 | <p>The audio HAL is composed of the following interfaces:</p> |
Heidi Miller | 54362a6 | 2014-10-24 16:00:04 -0700 | [diff] [blame] | 35 | |
Clay Murphy | 47b1d3f | 2013-10-03 10:02:22 -0700 | [diff] [blame] | 36 | <ul> |
Heidi von Markham | d0333d6 | 2016-07-08 12:05:46 -0700 | [diff] [blame] | 37 | <li><code>hardware/libhardware/include/hardware/audio.h</code>. Represents the |
| 38 | main functions of an audio device.</li> |
| 39 | <li><code>hardware/libhardware/include/hardware/audio_effect.h</code>. |
| 40 | Represents effects that can be applied to audio such as downmixing, echo, or |
| 41 | noise 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 |
| 48 | files:</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 Murphy | 47b1d3f | 2013-10-03 10:02:22 -0700 | [diff] [blame] | 55 | </ul> |
Heidi Miller | 54362a6 | 2014-10-24 16:00:04 -0700 | [diff] [blame] | 56 | |
| 57 | <p>For an example, refer to the implementation for the Galaxy Nexus at |
| 58 | <code>device/samsung/tuna/audio</code>.</p> |
Clay Murphy | 47b1d3f | 2013-10-03 10:02:22 -0700 | [diff] [blame] | 59 | |
Heidi von Markham | d0333d6 | 2016-07-08 12:05:46 -0700 | [diff] [blame] | 60 | <h2 id=next-steps>Next steps</h2> |
Rom Lemarchand | 44dda73 | 2015-04-03 15:10:10 -0700 | [diff] [blame] | 61 | |
Heidi von Markham | d0333d6 | 2016-07-08 12:05:46 -0700 | [diff] [blame] | 62 | <p>In addition to implementing the audio HAL, you must also create an |
| 63 | <a href="{@docRoot}devices/audio/implement-policy.html">audio policy |
| 64 | configuration file</a> that describes your audio topology and package the HAL |
| 65 | implementation into a |
| 66 | <a href="{@docRoot}devices/audio/implement-shared-library.html">shared |
| 67 | library</a>. You can also configure |
| 68 | <a href="{@docRoot}devices/audio/implement-pre-processing.html">pre-processing |
| 69 | effects</a> such as automatic gain control and noise suppression.</p> |