1 |
//////////////////////////////////////////////////////////////////////////////// |
2 |
/// |
3 |
/// Common type definitions for SoundTouch audio processing library. |
4 |
/// |
5 |
/// Author : Copyright (c) Olli Parviainen |
6 |
/// Author e-mail : oparviai 'at' iki.fi |
7 |
/// SoundTouch WWW: http://www.surina.net/soundtouch |
8 |
/// |
9 |
//////////////////////////////////////////////////////////////////////////////// |
10 |
// |
11 |
// Last changed : $Date: 2009-05-17 14:30:57 +0300 (Sun, 17 May 2009) $ |
12 |
// File revision : $Revision: 3 $ |
13 |
// |
14 |
// $Id: STTypes.h 70 2009-05-17 11:30:57Z oparviai $ |
15 |
// |
16 |
//////////////////////////////////////////////////////////////////////////////// |
17 |
// |
18 |
// License : |
19 |
// |
20 |
// SoundTouch audio processing library |
21 |
// Copyright (c) Olli Parviainen |
22 |
// |
23 |
// This library is free software; you can redistribute it and/or |
24 |
// modify it under the terms of the GNU Lesser General Public |
25 |
// License as published by the Free Software Foundation; either |
26 |
// version 2.1 of the License, or (at your option) any later version. |
27 |
// |
28 |
// This library is distributed in the hope that it will be useful, |
29 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
30 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
31 |
// Lesser General Public License for more details. |
32 |
// |
33 |
// You should have received a copy of the GNU Lesser General Public |
34 |
// License along with this library; if not, write to the Free Software |
35 |
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
36 |
// |
37 |
//////////////////////////////////////////////////////////////////////////////// |
38 |
|
39 |
#ifndef STTypes_H |
40 |
#define STTypes_H |
41 |
|
42 |
typedef unsigned int uint; |
43 |
typedef unsigned long ulong; |
44 |
|
45 |
#ifdef __GNUC__ |
46 |
// In GCC, include soundtouch_config.h made by config scritps |
47 |
#include "soundtouch_config.h" |
48 |
#endif |
49 |
|
50 |
#ifndef _WINDEF_ |
51 |
// if these aren't defined already by Windows headers, define now |
52 |
|
53 |
typedef int BOOL; |
54 |
|
55 |
#define FALSE 0 |
56 |
#define TRUE 1 |
57 |
|
58 |
#endif // _WINDEF_ |
59 |
|
60 |
|
61 |
namespace soundtouch |
62 |
{ |
63 |
|
64 |
/// Activate these undef's to overrule the possible sampletype |
65 |
/// setting inherited from some other header file: |
66 |
//#undef INTEGER_SAMPLES |
67 |
//#undef FLOAT_SAMPLES |
68 |
|
69 |
#if !(INTEGER_SAMPLES || FLOAT_SAMPLES) |
70 |
|
71 |
/// Choose either 32bit floating point or 16bit integer sampletype |
72 |
/// by choosing one of the following defines, unless this selection |
73 |
/// has already been done in some other file. |
74 |
//// |
75 |
/// Notes: |
76 |
/// - In Windows environment, choose the sample format with the |
77 |
/// following defines. |
78 |
/// - In GNU environment, the floating point samples are used by |
79 |
/// default, but integer samples can be chosen by giving the |
80 |
/// following switch to the configure script: |
81 |
/// ./configure --enable-integer-samples |
82 |
/// However, if you still prefer to select the sample format here |
83 |
/// also in GNU environment, then please #undef the INTEGER_SAMPLE |
84 |
/// and FLOAT_SAMPLE defines first as in comments above. |
85 |
//#define INTEGER_SAMPLES 1 //< 16bit integer samples |
86 |
#define FLOAT_SAMPLES 1 //< 32bit float samples |
87 |
|
88 |
#endif |
89 |
|
90 |
#if (WIN32 || __i386__ || __x86_64__) |
91 |
/// Define this to allow X86-specific assembler/intrinsic optimizations. |
92 |
/// Notice that library contains also usual C++ versions of each of these |
93 |
/// these routines, so if you're having difficulties getting the optimized |
94 |
/// routines compiled for whatever reason, you may disable these optimizations |
95 |
/// to make the library compile. |
96 |
|
97 |
#define ALLOW_X86_OPTIMIZATIONS 1 |
98 |
|
99 |
#endif |
100 |
|
101 |
// If defined, allows the SIMD-optimized routines to take minor shortcuts |
102 |
// for improved performance. Undefine to require faithfully similar SIMD |
103 |
// calculations as in normal C implementation. |
104 |
#define ALLOW_NONEXACT_SIMD_OPTIMIZATION 1 |
105 |
|
106 |
|
107 |
#ifdef INTEGER_SAMPLES |
108 |
// 16bit integer sample type |
109 |
typedef short SAMPLETYPE; |
110 |
// data type for sample accumulation: Use 32bit integer to prevent overflows |
111 |
typedef long LONG_SAMPLETYPE; |
112 |
|
113 |
#ifdef FLOAT_SAMPLES |
114 |
// check that only one sample type is defined |
115 |
#error "conflicting sample types defined" |
116 |
#endif // FLOAT_SAMPLES |
117 |
|
118 |
#ifdef ALLOW_X86_OPTIMIZATIONS |
119 |
// Allow MMX optimizations |
120 |
#define ALLOW_MMX 1 |
121 |
#endif |
122 |
|
123 |
#else |
124 |
|
125 |
// floating point samples |
126 |
typedef float SAMPLETYPE; |
127 |
// data type for sample accumulation: Use double to utilize full precision. |
128 |
typedef double LONG_SAMPLETYPE; |
129 |
|
130 |
#ifdef ALLOW_X86_OPTIMIZATIONS |
131 |
// Allow 3DNow! and SSE optimizations |
132 |
#if WIN32 |
133 |
#define ALLOW_3DNOW 1 |
134 |
#endif |
135 |
|
136 |
#define ALLOW_SSE 1 |
137 |
#endif |
138 |
|
139 |
#endif // INTEGER_SAMPLES |
140 |
}; |
141 |
|
142 |
|
143 |
// When this #define is active, eliminates a clicking sound when the "rate" or "pitch" |
144 |
// parameter setting crosses from value <1 to >=1 or vice versa during processing. |
145 |
// Default is off as such crossover is untypical case and involves a slight sound |
146 |
// quality compromise. |
147 |
//#define PREVENT_CLICK_AT_RATE_CROSSOVER 1 |
148 |
|
149 |
#endif |