blob: a4ee6b44f8ef1d54de7144a01aec7acffb6e9138 [file] [log] [blame]
<html devsite><head>
<title>音频实现</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>本部分介绍了如何实现音频硬件抽象层 (HAL),提供了有关配置音频策略(文件格式、代码组织、预处理效果)的详细信息,并说明了如何配置共享库(创建 <code>Android.mk</code> 文件)。</p>
<h2 id="implementing">实现音频 HAL</h2>
<p>音频 HAL 由以下接口组成:</p>
<ul>
<li><code>hardware/libhardware/include/hardware/audio.h</code>:表示音频设备的主函数。</li>
<li><code>hardware/libhardware/include/hardware/audio_effect.h</code>:表示可应用于音频的效果,如缩混、回音或噪音抑制。</li>
</ul>
<p>您必须实现所有接口。</p>
<h2 id="headers">音频标头文件</h2>
<p>要查看您可以定义的属性的参考,请参阅音频标头文件:</p>
<ul>
<li>在 Android 6.0 及更高版本中,请参阅 <code>system/media/audio/include/system/audio.h</code></li>
<li>在 Android 5.1 及更低版本中,请参阅 <code>system/core/include/system/audio.h</code></li>
</ul>
<p>例如,在 <code>device/samsung/tuna/audio</code> 中参阅 Galaxy Nexus 的实现。</p>
<h2 id="next-steps">后续步骤</h2>
<p>除了实现音频 HAL 之外,您还必须创建<a href="/devices/audio/implement-policy.html">音频策略配置文件</a>,用于描述您的音频拓扑,并将 HAL 实现打包到<a href="/devices/audio/implement-shared-library.html">共享库</a>中。您还可以配置<a href="/devices/audio/implement-pre-processing.html">预处理效果</a>,如自动增益控制和噪音抑制。</p>
</body></html>