1/* 2 * Copyright (C) 2013 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 LE_FX_ENGINE_COMMON_CORE_BASIC_TYPES_H_ 18#define LE_FX_ENGINE_COMMON_CORE_BASIC_TYPES_H_ 19 20#include <stddef.h> 21#include <stdlib.h> 22#include <string> 23using ::std::string; 24using ::std::basic_string; 25#include <vector> 26using ::std::vector; 27 28#include "common/core/os.h" 29 30// ----------------------------------------------------------------------------- 31// Definitions of common basic types: 32// ----------------------------------------------------------------------------- 33 34#if !defined(G_COMPILE) && !defined(BASE_INTEGRAL_TYPES_H_) 35 36namespace le_fx { 37 38typedef signed char schar; 39typedef signed char int8; 40typedef short int16; 41typedef int int32; 42typedef long long int64; 43 44typedef unsigned char uint8; 45typedef unsigned short uint16; 46typedef unsigned int uint32; 47typedef unsigned long long uint64; 48 49} // namespace le_fx 50 51#endif 52 53namespace le_fx { 54 55struct FloatArray { 56 int length; 57 float *data; 58 59 FloatArray(void) { 60 data = NULL; 61 length = 0; 62 } 63}; 64 65struct Int16Array { 66 int length; 67 int16 *data; 68 69 Int16Array(void) { 70 data = NULL; 71 length = 0; 72 } 73}; 74 75struct Int32Array { 76 int length; 77 int32 *data; 78 79 Int32Array(void) { 80 data = NULL; 81 length = 0; 82 } 83}; 84 85struct Int8Array { 86 int length; 87 uint8 *data; 88 89 Int8Array(void) { 90 data = NULL; 91 length = 0; 92 } 93}; 94 95// 96// Simple wrapper for waveform data: 97// 98class WaveData : public vector<int16> { 99 public: 100 WaveData(); 101 ~WaveData(); 102 103 void Set(int number_samples, int sampling_rate, int16 *data); 104 int sample_rate(void) const; 105 void set_sample_rate(int sample_rate); 106 bool Equals(const WaveData &wave_data, int threshold = 0) const; 107 108 private: 109 int sample_rate_; 110}; 111 112} // namespace le_fx 113 114#endif // LE_FX_ENGINE_COMMON_CORE_BASIC_TYPES_H_ 115