add global proxy / cache settings to httpget class. This removes the need of passing...
[Rockbox.git] / firmware / export / pcm_sampr.h
blobb27050ec603e19d9b8e4c9cbc613cecb9189e69b
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2006 by Michael Sevakis
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
20 #ifndef PCM_SAMPR_H
21 #define PCM_SAMPR_H
23 #ifndef HW_SAMPR_CAPS
24 #define HW_SAMPR_CAPS SAMPR_CAP_44 /* if not defined, default to 44100 */
25 #endif
27 /* These must be macros for comparison with SAMPR_CAP_* flags by the
28 preprocessor. Add samplerate index in descending order renumbering
29 the ones later in the list if any */
30 #define FREQ_96 0
31 #define FREQ_88 1
32 #define FREQ_64 2
33 #define FREQ_48 3
34 #define FREQ_44 4
35 #define FREQ_32 5
36 #define FREQ_24 6
37 #define FREQ_22 7
38 #define FREQ_16 8
39 #define FREQ_12 9
40 #define FREQ_11 10
41 #define FREQ_8 11
42 #define SAMPR_NUM_FREQ 12
44 /* sample rate values in HZ */
45 #define SAMPR_96 96000
46 #define SAMPR_88 88200
47 #define SAMPR_64 64000
48 #define SAMPR_48 48000
49 #define SAMPR_44 44100
50 #define SAMPR_32 32000
51 #define SAMPR_24 24000
52 #define SAMPR_22 22050
53 #define SAMPR_16 16000
54 #define SAMPR_12 12000
55 #define SAMPR_11 11025
56 #define SAMPR_8 8000
58 /* sample rate capability bits */
59 #define SAMPR_CAP_96 (1 << FREQ_96)
60 #define SAMPR_CAP_88 (1 << FREQ_88)
61 #define SAMPR_CAP_64 (1 << FREQ_64)
62 #define SAMPR_CAP_48 (1 << FREQ_48)
63 #define SAMPR_CAP_44 (1 << FREQ_44)
64 #define SAMPR_CAP_32 (1 << FREQ_32)
65 #define SAMPR_CAP_24 (1 << FREQ_24)
66 #define SAMPR_CAP_22 (1 << FREQ_22)
67 #define SAMPR_CAP_16 (1 << FREQ_16)
68 #define SAMPR_CAP_12 (1 << FREQ_12)
69 #define SAMPR_CAP_11 (1 << FREQ_11)
70 #define SAMPR_CAP_8 (1 << FREQ_8)
71 #define SAMPR_CAP_ALL (SAMPR_CAP_96 | SAMPR_CAP_88 | SAMPR_CAP_64 | \
72 SAMPR_CAP_48 | SAMPR_CAP_44 | SAMPR_CAP_32 | \
73 SAMPR_CAP_24 | SAMPR_CAP_22 | SAMPR_CAP_16 | \
74 SAMPR_CAP_12 | SAMPR_CAP_11 | SAMPR_CAP_8)
76 /* Master list of all "standard" rates supported. */
77 extern const unsigned long audio_master_sampr_list[SAMPR_NUM_FREQ];
79 /** Hardware sample rates **/
81 /* Enumeration of supported frequencies where 0 is the highest rate
82 supported and REC_NUM_FREQUENCIES is the number available */
83 enum hw_freq_indexes
85 __HW_FREQ_START_INDEX = -1, /* Make sure first in list is 0 */
87 /* 96000 */
88 #if (HW_SAMPR_CAPS & SAMPR_CAP_96) /* Macros and enums for each FREQ: */
89 HW_FREQ_96, /* Index in enumeration */
90 #define HW_HAVE_96 /* Defined if this FREQ is defined */
91 #define HW_HAVE_96_(...) __VA_ARGS__ /* Output its parameters for this FREQ */
92 #else
93 #define HW_HAVE_96_(...) /* Discards its parameters for this FREQ */
94 #endif
95 /* 88200 */
96 #if (HW_SAMPR_CAPS & SAMPR_CAP_88)
97 HW_FREQ_88,
98 #define HW_HAVE_88
99 #define HW_HAVE_88_(...) __VA_ARGS__
100 #else
101 #define HW_HAVE_88_(...)
102 #endif
103 /* 64000 */
104 #if (HW_SAMPR_CAPS & SAMPR_CAP_64)
105 HW_FREQ_64,
106 #define HW_HAVE_64
107 #define HW_HAVE_64_(...) __VA_ARGS__
108 #else
109 #define HW_HAVE_64_(...)
110 #endif
111 /* 48000 */
112 #if (HW_SAMPR_CAPS & SAMPR_CAP_48)
113 HW_FREQ_48,
114 #define HW_HAVE_48
115 #define HW_HAVE_48_(...) __VA_ARGS__
116 #else
117 #define HW_HAVE_48_(...)
118 #endif
119 /* 44100 */
120 #if (HW_SAMPR_CAPS & SAMPR_CAP_44)
121 HW_FREQ_44,
122 #define HW_HAVE_44
123 #define HW_HAVE_44_(...) __VA_ARGS__
124 #else
125 #define HW_HAVE_44_(...)
126 #endif
127 /* 32000 */
128 #if (HW_SAMPR_CAPS & SAMPR_CAP_32)
129 HW_FREQ_32,
130 #define HW_HAVE_32
131 #define HW_HAVE_32_(...) __VA_ARGS__
132 #else
133 #define HW_HAVE_32_(...)
134 #endif
135 /* 24000 */
136 #if (HW_SAMPR_CAPS & SAMPR_CAP_24)
137 HW_FREQ_24,
138 #define HW_HAVE_24
139 #define HW_HAVE_24_(...) __VA_ARGS__
140 #else
141 #define HW_HAVE_24_(...)
142 #endif
143 /* 22050 */
144 #if (HW_SAMPR_CAPS & SAMPR_CAP_22)
145 HW_FREQ_22,
146 #define HW_HAVE_22
147 #define HW_HAVE_22_(...) __VA_ARGS__
148 #else
149 #define HW_HAVE_22_(...)
150 #endif
151 /* 16000 */
152 #if (HW_SAMPR_CAPS & SAMPR_CAP_16)
153 HW_FREQ_16,
154 #define HW_HAVE_16
155 #define HW_HAVE_16_(...) __VA_ARGS__
156 #else
157 #define HW_HAVE_16_(...)
158 #endif
159 /* 12000 */
160 #if (HW_SAMPR_CAPS & SAMPR_CAP_12)
161 HW_FREQ_12,
162 #define HW_HAVE_12
163 #define HW_HAVE_12_(...) __VA_ARGS__
164 #else
165 #define HW_HAVE_12_(...)
166 #endif
167 /* 11025 */
168 #if (HW_SAMPR_CAPS & SAMPR_CAP_11)
169 HW_FREQ_11,
170 #define HW_HAVE_11
171 #define HW_HAVE_11_(...) __VA_ARGS__
172 #else
173 #define HW_HAVE_11_(...)
174 #endif
175 /* 8000 */
176 #if (HW_SAMPR_CAPS & SAMPR_CAP_8 )
177 HW_FREQ_8,
178 #define HW_HAVE_8
179 #define HW_HAVE_8_(...) __VA_ARGS__
180 #else
181 #define HW_HAVE_8_(...)
182 #endif
183 HW_NUM_FREQ,
184 HW_FREQ_DEFAULT = HW_FREQ_44,
185 HW_SAMPR_DEFAULT = SAMPR_44,
186 }; /* enum hw_freq_indexes */
188 /* list of hardware sample rates */
189 extern const unsigned long hw_freq_sampr[HW_NUM_FREQ];
191 #ifdef HAVE_RECORDING
192 /* Enumeration of supported frequencies where 0 is the highest rate
193 supported and REC_NUM_FREQUENCIES is the number available */
194 enum rec_freq_indexes
196 __REC_FREQ_START_INDEX = -1, /* Make sure first in list is 0 */
198 /* 96000 */
199 #if (REC_SAMPR_CAPS & SAMPR_CAP_96) /* Macros and enums for each FREQ: */
200 REC_FREQ_96, /* Index in enumeration */
201 #define REC_HAVE_96 /* Defined if this FREQ is defined */
202 #define REC_HAVE_96_(...) __VA_ARGS__ /* Output its parameters for this FREQ */
203 #else
204 #define REC_HAVE_96_(...) /* Discards its parameters for this FREQ */
205 #endif
206 /* 88200 */
207 #if (REC_SAMPR_CAPS & SAMPR_CAP_88)
208 REC_FREQ_88,
209 #define REC_HAVE_88
210 #define REC_HAVE_88_(...) __VA_ARGS__
211 #else
212 #define REC_HAVE_88_(...)
213 #endif
214 /* 64000 */
215 #if (REC_SAMPR_CAPS & SAMPR_CAP_64)
216 REC_FREQ_64,
217 #define REC_HAVE_64
218 #define REC_HAVE_64_(...) __VA_ARGS__
219 #else
220 #define REC_HAVE_64_(...)
221 #endif
222 /* 48000 */
223 #if (REC_SAMPR_CAPS & SAMPR_CAP_48)
224 REC_FREQ_48,
225 #define REC_HAVE_48
226 #define REC_HAVE_48_(...) __VA_ARGS__
227 #else
228 #define REC_HAVE_48_(...)
229 #endif
230 /* 44100 */
231 #if (REC_SAMPR_CAPS & SAMPR_CAP_44)
232 REC_FREQ_44,
233 #define REC_HAVE_44
234 #define REC_HAVE_44_(...) __VA_ARGS__
235 #else
236 #define REC_HAVE_44_(...)
237 #endif
238 /* 32000 */
239 #if (REC_SAMPR_CAPS & SAMPR_CAP_32)
240 REC_FREQ_32,
241 #define REC_HAVE_32
242 #define REC_HAVE_32_(...) __VA_ARGS__
243 #else
244 #define REC_HAVE_32_(...)
245 #endif
246 /* 24000 */
247 #if (REC_SAMPR_CAPS & SAMPR_CAP_24)
248 REC_FREQ_24,
249 #define REC_HAVE_24
250 #define REC_HAVE_24_(...) __VA_ARGS__
251 #else
252 #define REC_HAVE_24_(...)
253 #endif
254 /* 22050 */
255 #if (REC_SAMPR_CAPS & SAMPR_CAP_22)
256 REC_FREQ_22,
257 #define REC_HAVE_22
258 #define REC_HAVE_22_(...) __VA_ARGS__
259 #else
260 #define REC_HAVE_22_(...)
261 #endif
262 /* 16000 */
263 #if (REC_SAMPR_CAPS & SAMPR_CAP_16)
264 REC_FREQ_16,
265 #define REC_HAVE_16
266 #define REC_HAVE_16_(...) __VA_ARGS__
267 #else
268 #define REC_HAVE_16_(...)
269 #endif
270 /* 12000 */
271 #if (REC_SAMPR_CAPS & SAMPR_CAP_12)
272 REC_FREQ_12,
273 #define REC_HAVE_12
274 #define REC_HAVE_12_(...) __VA_ARGS__
275 #else
276 #define REC_HAVE_12_(...)
277 #endif
278 /* 11025 */
279 #if (REC_SAMPR_CAPS & SAMPR_CAP_11)
280 REC_FREQ_11,
281 #define REC_HAVE_11
282 #define REC_HAVE_11_(...) __VA_ARGS__
283 #else
284 #define REC_HAVE_11_(...)
285 #endif
286 /* 8000 */
287 #if (REC_SAMPR_CAPS & SAMPR_CAP_8 )
288 REC_FREQ_8,
289 #define REC_HAVE_8
290 #define REC_HAVE_8_(...) __VA_ARGS__
291 #else
292 #define REC_HAVE_8_(...)
293 #endif
294 REC_NUM_FREQ,
295 }; /* enum rec_freq_indexes */
297 /* Default to 44.1kHz if not otherwise specified */
298 #ifndef REC_FREQ_DEFAULT
299 #define REC_FREQ_DEFAULT REC_FREQ_44
300 #endif
302 #define REC_FREQ_CFG_VAL_LIST &REC_HAVE_96_(",96") REC_HAVE_88_(",88") \
303 REC_HAVE_64_(",64") REC_HAVE_48_(",48") \
304 REC_HAVE_44_(",44") REC_HAVE_32_(",32") \
305 REC_HAVE_24_(",24") REC_HAVE_22_(",22") \
306 REC_HAVE_16_(",16") REC_HAVE_12_(",12") \
307 REC_HAVE_11_(",11") REC_HAVE_8_(",8")[1]
309 /* List of recording supported sample rates (set or subset of master list) */
310 extern const unsigned long rec_freq_sampr[REC_NUM_FREQ];
311 #endif /* HAVE_RECORDING */
313 #endif /* PCM_SAMPR_H */