Don Turner | 2682fbd | 2017-09-12 16:25:58 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef OBOE_OPENSLES_OPENSLESUTILITIES_H |
| 18 | #define OBOE_OPENSLES_OPENSLESUTILITIES_H |
| 19 | |
| 20 | #include <SLES/OpenSLES_Android.h> |
Phil Burk | 9a147a1 | 2017-12-13 20:23:25 -0800 | [diff] [blame] | 21 | #include "oboe/Oboe.h" |
Don Turner | 2682fbd | 2017-09-12 16:25:58 +0100 | [diff] [blame] | 22 | |
Don Turner | 3bf32ae | 2017-11-27 13:25:05 +0000 | [diff] [blame] | 23 | namespace oboe { |
| 24 | |
Phil Burk | 9a147a1 | 2017-12-13 20:23:25 -0800 | [diff] [blame] | 25 | const char *getSLErrStr(SLresult code); |
| 26 | |
Phil Burk | 17d8001 | 2018-06-29 18:32:55 -0700 | [diff] [blame] | 27 | #if __ANDROID_API__ >= __ANDROID_API_L__ |
Don Turner | 2682fbd | 2017-09-12 16:25:58 +0100 | [diff] [blame] | 28 | /** |
| 29 | * Creates an extended PCM format from the supplied format and data representation. This method |
| 30 | * should only be called on Android devices with API level 21+. API 21 introduced the |
| 31 | * SLAndroidDataFormat_PCM_EX object which allows audio samples to be represented using |
| 32 | * single precision floating-point. |
| 33 | * |
| 34 | * @param format |
| 35 | * @param representation |
| 36 | * @return the extended PCM format |
| 37 | */ |
| 38 | SLAndroidDataFormat_PCM_EX OpenSLES_createExtendedFormat(SLDataFormat_PCM format, |
| 39 | SLuint32 representation); |
| 40 | |
Phil Burk | 17d8001 | 2018-06-29 18:32:55 -0700 | [diff] [blame] | 41 | SLuint32 OpenSLES_ConvertFormatToRepresentation(AudioFormat format); |
| 42 | #endif // __ANDROID_API_L__ |
Phil Burk | 9a147a1 | 2017-12-13 20:23:25 -0800 | [diff] [blame] | 43 | |
Don Turner | 3bf32ae | 2017-11-27 13:25:05 +0000 | [diff] [blame] | 44 | } // namespace oboe |
| 45 | |
Don Turner | 2682fbd | 2017-09-12 16:25:58 +0100 | [diff] [blame] | 46 | #endif //OBOE_OPENSLES_OPENSLESUTILITIES_H |