OpenSL ES
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
注意:开发者应考虑使用开源 Oboe 库,这个库可在 GitHub 上获得。Oboe 是一个 C++ 封装容器,提供与 AAudio 非常相似的 API。Oboe 在 AAudio 可用时对其进行调用,并在 AAudio 不可用时回退到 OpenSL ES。
NDK 软件包中包含 Khronos Group 开发的 OpenSL ES™ 1.0.1 API 规范的一个Android 专有实现。利用这个库,不论您是编写合成器、数字音频工作站、卡拉 OK、游戏还是其他实时应用,都可以使用 C 或 C++ 实现高性能、短延迟时间音频。
OpenSL ES™ 标准与 Android Java 框架中的 MediaPlayer
和 MediaRecorder
API 提供类似的音频功能。OpenSL ES 提供 C 语言接口和 C++ 绑定,让您可以从使用任意一种语言编写的代码中调用 API。
OpenSL ES API 可以帮助您开发和提升应用的音频性能。
标准 OpenSL ES 头文件 <SLES/OpenSLES.h> 和 <SLES/OpenSLES_Platform.h> 允许音频输入和输出。<SLES/OpenSLES_Android.h> 和 <SLES/OpenSLES_AndroidConfiguration.h> 中提供了其他 Android 专用功能。
本部分首先说明如何将 OpenSL ES 整合到您的应用中。然后,介绍您需要了解的 OpenSL ES 的 Android 实现相关信息,其中首先会重点介绍此实现与参考规范之间的差异,然后介绍用于确保 Android 兼容性的其他扩展。最后,本部分提供一些补充性的编程说明,用于确保正确实现 OpenSL ES。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-01-10。
[null,null,["最后更新时间 (UTC):2024-01-10。"],[],[],null,["# OpenSL ES\n\nWARNING: OpenSL ES is **deprecated** . Developers should use the open source\nOboe library which is available on [GitHub](https://github.com/google/oboe).\nOboe is a C++ wrapper that provides an API that closely resembles\n[AAudio](/ndk/guides/audio/aaudio/aaudio). Oboe calls AAudio when AAudio is\navailable, and falls back to OpenSL ES if AAudio is not available.\n\nThe NDK package includes an Android-specific implementation of the\n[OpenSL ES™](https://www.khronos.org/opensles/) 1.0.1 API\nspecification from the [Khronos Group](https://www.khronos.org).\nThis library lets you use C or C++ to implement high-performance, low-latency audio, whether\nyou are writing a synthesizer, digital audio workstation, karaoke, game,\nor other real-time app.\n\n\nThe OpenSL ES™ standard exposes audio features\nsimilar to those in the [MediaPlayer](/reference/android/media/MediaPlayer) and [MediaRecorder](/reference/android/media/MediaRecorder)\nAPIs in the Android Java framework. OpenSL ES provides a C language interface as well as\nC++ bindings, allowing you to call the API from code written in either language.\n\n\nThe OpenSL ES APIs are available to help you develop and improve your app's audio performance.\n\n\nThe standard OpenSL ES headers \\\u003cSLES/OpenSLES.h\\\u003e and\n\\\u003cSLES/OpenSLES_Platform.h\\\u003e allow audio input and output. Additional\nAndroid-specific functionality is in \\\u003cSLES/OpenSLES_Android.h\\\u003e and\n\\\u003cSLES/OpenSLES_AndroidConfiguration.h\\\u003e.\n\nThis section begins by explaining\n[how to incorporate OpenSL ES into your app](/ndk/guides/audio/opensl/getting-started).\nNext, it explains what you need to know\nabout the Android implementation of OpenSL ES, focusing first on the\n[differences](/ndk/guides/audio/opensl/opensl-for-android) between this implementation and the\nreference specification and then\n[additional extensions](/ndk/guides/audio/opensl/android-extensions)\nfor Android compatibility. This section concludes with some supplemental\n[programming notes](/ndk/guides/audio/opensl/opensl-prog-notes) to ensure proper\nimplementation of OpenSL ES."]]