OpenSL ES
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
注意:開發人員應考慮使用可於 GitHub 取得的開放原始碼 Oboe 程式庫。Oboe 是 C++ 包裝函式,提供與 AAudio 非常相似的 API。Oboe 會在 AAudio 可用時呼叫 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 和/或其關係企業的商標或註冊商標。
上次更新時間:2024-01-10 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間: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."]]