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