1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/libsoundtouch/src/STTypes.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,189 @@ 1.4 +//////////////////////////////////////////////////////////////////////////////// 1.5 +/// 1.6 +/// Common type definitions for SoundTouch audio processing library. 1.7 +/// 1.8 +/// Author : Copyright (c) Olli Parviainen 1.9 +/// Author e-mail : oparviai 'at' iki.fi 1.10 +/// SoundTouch WWW: http://www.surina.net/soundtouch 1.11 +/// 1.12 +//////////////////////////////////////////////////////////////////////////////// 1.13 +// 1.14 +// Last changed : $Date: 2014-04-06 10:57:21 -0500 (Sun, 06 Apr 2014) $ 1.15 +// File revision : $Revision: 3 $ 1.16 +// 1.17 +// $Id: STTypes.h 195 2014-04-06 15:57:21Z oparviai $ 1.18 +// 1.19 +//////////////////////////////////////////////////////////////////////////////// 1.20 +// 1.21 +// License : 1.22 +// 1.23 +// SoundTouch audio processing library 1.24 +// Copyright (c) Olli Parviainen 1.25 +// 1.26 +// This library is free software; you can redistribute it and/or 1.27 +// modify it under the terms of the GNU Lesser General Public 1.28 +// License as published by the Free Software Foundation; either 1.29 +// version 2.1 of the License, or (at your option) any later version. 1.30 +// 1.31 +// This library is distributed in the hope that it will be useful, 1.32 +// but WITHOUT ANY WARRANTY; without even the implied warranty of 1.33 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1.34 +// Lesser General Public License for more details. 1.35 +// 1.36 +// You should have received a copy of the GNU Lesser General Public 1.37 +// License along with this library; if not, write to the Free Software 1.38 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 1.39 +// 1.40 +//////////////////////////////////////////////////////////////////////////////// 1.41 + 1.42 +#ifndef STTypes_H 1.43 +#define STTypes_H 1.44 + 1.45 +typedef unsigned int uint; 1.46 +typedef unsigned long ulong; 1.47 + 1.48 +// Patch for MinGW: on Win64 long is 32-bit 1.49 +#ifdef _WIN64 1.50 + typedef unsigned long long ulongptr; 1.51 +#else 1.52 + typedef ulong ulongptr; 1.53 +#endif 1.54 + 1.55 + 1.56 +// Helper macro for aligning pointer up to next 16-byte boundary 1.57 +#define SOUNDTOUCH_ALIGN_POINTER_16(x) ( ( (ulongptr)(x) + 15 ) & ~(ulongptr)15 ) 1.58 + 1.59 + 1.60 +#include "soundtouch_config.h" 1.61 + 1.62 +#ifdef WIN32 1.63 +#ifdef BUILDING_SOUNDTOUCH 1.64 +#define EXPORT __declspec(dllexport) 1.65 +#else 1.66 +#define EXPORT __declspec(dllimport) 1.67 +#endif 1.68 +#else 1.69 +#define EXPORT 1.70 +#endif 1.71 + 1.72 +namespace soundtouch 1.73 +{ 1.74 + /// Activate these undef's to overrule the possible sampletype 1.75 + /// setting inherited from some other header file: 1.76 + //#undef SOUNDTOUCH_INTEGER_SAMPLES 1.77 + //#undef SOUNDTOUCH_FLOAT_SAMPLES 1.78 + 1.79 + /// If following flag is defined, always uses multichannel processing 1.80 + /// routines also for mono and stero sound. This is for routine testing 1.81 + /// purposes; output should be same with either routines, yet disabling 1.82 + /// the dedicated mono/stereo processing routines will result in slower 1.83 + /// runtime performance so recommendation is to keep this off. 1.84 + // #define USE_MULTICH_ALWAYS 1.85 + 1.86 + #if (defined(__SOFTFP__)) 1.87 + // For Android compilation: Force use of Integer samples in case that 1.88 + // compilation uses soft-floating point emulation - soft-fp is way too slow 1.89 + #undef SOUNDTOUCH_FLOAT_SAMPLES 1.90 + #define SOUNDTOUCH_INTEGER_SAMPLES 1 1.91 + #endif 1.92 + 1.93 + #if !(SOUNDTOUCH_INTEGER_SAMPLES || SOUNDTOUCH_FLOAT_SAMPLES) 1.94 + 1.95 + /// Choose either 32bit floating point or 16bit integer sampletype 1.96 + /// by choosing one of the following defines, unless this selection 1.97 + /// has already been done in some other file. 1.98 + //// 1.99 + /// Notes: 1.100 + /// - In Windows environment, choose the sample format with the 1.101 + /// following defines. 1.102 + /// - In GNU environment, the floating point samples are used by 1.103 + /// default, but integer samples can be chosen by giving the 1.104 + /// following switch to the configure script: 1.105 + /// ./configure --enable-integer-samples 1.106 + /// However, if you still prefer to select the sample format here 1.107 + /// also in GNU environment, then please #undef the INTEGER_SAMPLE 1.108 + /// and FLOAT_SAMPLE defines first as in comments above. 1.109 + //#define SOUNDTOUCH_INTEGER_SAMPLES 1 //< 16bit integer samples 1.110 + #define SOUNDTOUCH_FLOAT_SAMPLES 1 //< 32bit float samples 1.111 + 1.112 + #endif 1.113 + 1.114 + #if (_M_IX86 || __i386__ || __x86_64__ || _M_X64) 1.115 + /// Define this to allow X86-specific assembler/intrinsic optimizations. 1.116 + /// Notice that library contains also usual C++ versions of each of these 1.117 + /// these routines, so if you're having difficulties getting the optimized 1.118 + /// routines compiled for whatever reason, you may disable these optimizations 1.119 + /// to make the library compile. 1.120 + 1.121 + #define SOUNDTOUCH_ALLOW_X86_OPTIMIZATIONS 1 1.122 + 1.123 + /// In GNU environment, allow the user to override this setting by 1.124 + /// giving the following switch to the configure script: 1.125 + /// ./configure --disable-x86-optimizations 1.126 + /// ./configure --enable-x86-optimizations=no 1.127 + #ifdef SOUNDTOUCH_DISABLE_X86_OPTIMIZATIONS 1.128 + #undef SOUNDTOUCH_ALLOW_X86_OPTIMIZATIONS 1.129 + #endif 1.130 + #else 1.131 + /// Always disable optimizations when not using a x86 systems. 1.132 + #undef SOUNDTOUCH_ALLOW_X86_OPTIMIZATIONS 1.133 + 1.134 + #endif 1.135 + 1.136 + // If defined, allows the SIMD-optimized routines to take minor shortcuts 1.137 + // for improved performance. Undefine to require faithfully similar SIMD 1.138 + // calculations as in normal C implementation. 1.139 + #define SOUNDTOUCH_ALLOW_NONEXACT_SIMD_OPTIMIZATION 1 1.140 + 1.141 + 1.142 + #ifdef SOUNDTOUCH_INTEGER_SAMPLES 1.143 + // 16bit integer sample type 1.144 + typedef short SAMPLETYPE; 1.145 + // data type for sample accumulation: Use 32bit integer to prevent overflows 1.146 + typedef long LONG_SAMPLETYPE; 1.147 + 1.148 + #ifdef SOUNDTOUCH_FLOAT_SAMPLES 1.149 + // check that only one sample type is defined 1.150 + #error "conflicting sample types defined" 1.151 + #endif // SOUNDTOUCH_FLOAT_SAMPLES 1.152 + 1.153 + #ifdef SOUNDTOUCH_ALLOW_X86_OPTIMIZATIONS 1.154 + // Allow MMX optimizations 1.155 + #define SOUNDTOUCH_ALLOW_MMX 1 1.156 + #endif 1.157 + 1.158 + #else 1.159 + 1.160 + // floating point samples 1.161 + typedef float SAMPLETYPE; 1.162 + // data type for sample accumulation: Use double to utilize full precision. 1.163 + typedef double LONG_SAMPLETYPE; 1.164 + 1.165 + #ifdef SOUNDTOUCH_ALLOW_X86_OPTIMIZATIONS 1.166 + // Allow SSE optimizations 1.167 + #define SOUNDTOUCH_ALLOW_SSE 1 1.168 + #endif 1.169 + 1.170 + #endif // SOUNDTOUCH_INTEGER_SAMPLES 1.171 + 1.172 +}; 1.173 + 1.174 +// define ST_NO_EXCEPTION_HANDLING switch to disable throwing std exceptions: 1.175 +#define ST_NO_EXCEPTION_HANDLING 1 1.176 +#ifdef ST_NO_EXCEPTION_HANDLING 1.177 + // Exceptions disabled. Throw asserts instead if enabled. 1.178 + #include <assert.h> 1.179 + #define ST_THROW_RT_ERROR(x) {assert((const char *)x);} 1.180 +#else 1.181 + // use c++ standard exceptions 1.182 + #include <stdexcept> 1.183 + #define ST_THROW_RT_ERROR(x) {throw std::runtime_error(x);} 1.184 +#endif 1.185 + 1.186 +// When this #define is active, eliminates a clicking sound when the "rate" or "pitch" 1.187 +// parameter setting crosses from value <1 to >=1 or vice versa during processing. 1.188 +// Default is off as such crossover is untypical case and involves a slight sound 1.189 +// quality compromise. 1.190 +//#define SOUNDTOUCH_PREVENT_CLICK_AT_RATE_CROSSOVER 1 1.191 + 1.192 +#endif