blob: 20f5498e52e2a655a2f5b7eea5b9a73b2743522b [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
Don Turner2682fbd2017-09-12 16:25:58 +010027/**
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 */
37SLAndroidDataFormat_PCM_EX OpenSLES_createExtendedFormat(SLDataFormat_PCM format,
38 SLuint32 representation);
39
Phil Burk9a147a12017-12-13 20:23:25 -080040
41SLuint32 OpenSLES_ConvertFormatToRepresentation(AudioFormat format);
42
Don Turner3bf32ae2017-11-27 13:25:05 +000043} // namespace oboe
44
Don Turner2682fbd2017-09-12 16:25:58 +010045#endif //OBOE_OPENSLES_OPENSLESUTILITIES_H