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