blob: dbcd7c9f14ca6d60fa3ce37c42bbd2d3425657ea [file] [log] [blame]
Don Turner2682fbd2017-09-12 16:25:58 +01001/*
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 Burk9a147a12017-12-13 20:23:25 -080021#include "oboe/Oboe.h"
Don Turner2682fbd2017-09-12 16:25:58 +010022
Don Turner3bf32ae2017-11-27 13:25:05 +000023namespace oboe {
24
Phil Burk9a147a12017-12-13 20:23:25 -080025const char *getSLErrStr(SLresult code);
26
Phil Burk17d80012018-06-29 18:32:55 -070027#if __ANDROID_API__ >= __ANDROID_API_L__
Don Turner2682fbd2017-09-12 16:25:58 +010028/**
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 */
38SLAndroidDataFormat_PCM_EX OpenSLES_createExtendedFormat(SLDataFormat_PCM format,
39 SLuint32 representation);
40
Phil Burk17d80012018-06-29 18:32:55 -070041SLuint32 OpenSLES_ConvertFormatToRepresentation(AudioFormat format);
42#endif // __ANDROID_API_L__
Phil Burk9a147a12017-12-13 20:23:25 -080043
Don Turner3bf32ae2017-11-27 13:25:05 +000044} // namespace oboe
45
Don Turner2682fbd2017-09-12 16:25:58 +010046#endif //OBOE_OPENSLES_OPENSLESUTILITIES_H