Oboe
A library for creating real-time audio apps on Android
Loading...
Searching...
No Matches
Utilities.h
1/*
2 * Copyright 2016 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_UTILITIES_H
18#define OBOE_UTILITIES_H
19
20#include <unistd.h>
21#include <sys/types.h>
22#include <string>
23#include "oboe/Definitions.h"
24
25namespace oboe {
26
34void convertFloatToPcm16(const float *source, int16_t *destination, int32_t numSamples);
35
43void convertPcm16ToFloat(const int16_t *source, float *destination, int32_t numSamples);
44
48int32_t convertFormatToSizeInBytes(AudioFormat format);
49
59template <typename FromType>
60const char * convertToText(FromType input);
61
66std::string getPropertyString(const char * name);
67
73int getPropertyInteger(const char * name, int defaultValue);
74
83int getSdkVersion();
84
93bool isAtLeastPreReleaseCodename(const std::string& codename);
94
95int getChannelCountFromChannelMask(ChannelMask channelMask);
96
97} // namespace oboe
98
99#endif //OBOE_UTILITIES_H