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> 21 #include "oboe/Oboe.h" 22 23 namespace oboe { 24 25 const char *getSLErrStr(SLresult code); 26 27 /** 28 * Creates an extended PCM format from the supplied format and data representation. This method 29 * should only be called on Android devices with API level 21+. API 21 introduced the 30 * SLAndroidDataFormat_PCM_EX object which allows audio samples to be represented using 31 * single precision floating-point. 32 * 33 * @param format 34 * @param representation 35 * @return the extended PCM format 36 */ 37 SLAndroidDataFormat_PCM_EX OpenSLES_createExtendedFormat(SLDataFormat_PCM format, 38 SLuint32 representation); 39 40 SLuint32 OpenSLES_ConvertFormatToRepresentation(AudioFormat format); 41 42 } // namespace oboe 43 44 #endif //OBOE_OPENSLES_OPENSLESUTILITIES_H 45