Mercurial > SDL_sound_CoreAudio
annotate alt_audio_convert.h @ 528:61a317171ef0 stable-1.0
Merge r536:537 from trunk: Speex bogus data check.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Fri, 11 Apr 2008 19:55:10 +0000 |
parents | 5b00e43ec23c |
children | 45ee760a6f5a |
rev | line source |
---|---|
338 | 1 /* |
365
f61eadea1f44
More revisions from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
360
diff
changeset
|
2 * Extended Audio Converter for SDL (Simple DirectMedia Layer) |
f61eadea1f44
More revisions from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
360
diff
changeset
|
3 * Copyright (C) 2002 Frank Ranostaj |
f61eadea1f44
More revisions from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
360
diff
changeset
|
4 * Institute of Applied Physik |
f61eadea1f44
More revisions from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
360
diff
changeset
|
5 * Johann Wolfgang Goethe-Universität |
f61eadea1f44
More revisions from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
360
diff
changeset
|
6 * Frankfurt am Main, Germany |
f61eadea1f44
More revisions from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
360
diff
changeset
|
7 * |
f61eadea1f44
More revisions from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
360
diff
changeset
|
8 * This library is free software; you can redistribute it and/or |
f61eadea1f44
More revisions from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
360
diff
changeset
|
9 * modify it under the terms of the GNU Library General Public |
f61eadea1f44
More revisions from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
360
diff
changeset
|
10 * License as published by the Free Software Foundation; either |
f61eadea1f44
More revisions from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
360
diff
changeset
|
11 * version 2 of the License, or (at your option) any later version. |
f61eadea1f44
More revisions from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
360
diff
changeset
|
12 * |
f61eadea1f44
More revisions from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
360
diff
changeset
|
13 * This library is distributed in the hope that it will be useful, |
f61eadea1f44
More revisions from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
360
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
f61eadea1f44
More revisions from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
360
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
f61eadea1f44
More revisions from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
360
diff
changeset
|
16 * Library General Public License for more details. |
f61eadea1f44
More revisions from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
360
diff
changeset
|
17 * |
f61eadea1f44
More revisions from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
360
diff
changeset
|
18 * You should have received a copy of the GNU Library General Public |
f61eadea1f44
More revisions from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
360
diff
changeset
|
19 * License along with this library; if not, write to the Free |
f61eadea1f44
More revisions from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
360
diff
changeset
|
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
f61eadea1f44
More revisions from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
360
diff
changeset
|
21 * |
f61eadea1f44
More revisions from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
360
diff
changeset
|
22 * Frank Ranostaj |
f61eadea1f44
More revisions from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
360
diff
changeset
|
23 * ranostaj@stud.uni-frankfurt.de |
f61eadea1f44
More revisions from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
360
diff
changeset
|
24 * |
f61eadea1f44
More revisions from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
360
diff
changeset
|
25 * (This code blatantly abducted for SDL_sound. Thanks, Frank! --ryan.) |
f61eadea1f44
More revisions from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
360
diff
changeset
|
26 */ |
338 | 27 |
366
eda146d666d1
More patches from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
365
diff
changeset
|
28 #ifndef _INCLUDE_AUDIO_CONVERT_H_ |
eda146d666d1
More patches from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
365
diff
changeset
|
29 #define _INCLUDE_AUDIO_CONVERT_H_ |
338 | 30 |
31 #include "SDL_audio.h" | |
32 #define Sound_AI_Loop 0x2 | |
366
eda146d666d1
More patches from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
365
diff
changeset
|
33 #define _fsize 32 |
338 | 34 |
380
44ed8bdeba74
More fixes from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
373
diff
changeset
|
35 typedef struct{ |
44ed8bdeba74
More fixes from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
373
diff
changeset
|
36 Sint16 numerator; |
44ed8bdeba74
More fixes from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
373
diff
changeset
|
37 Sint16 denominator; |
44ed8bdeba74
More fixes from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
373
diff
changeset
|
38 } Fraction; |
338 | 39 |
40 typedef struct{ | |
366
eda146d666d1
More patches from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
365
diff
changeset
|
41 Sint16 c[16][4*_fsize]; |
371 | 42 Uint8 incr[16]; |
380
44ed8bdeba74
More fixes from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
373
diff
changeset
|
43 Fraction ratio; |
373
24a610dfbbfd
More altcvt updates from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
371
diff
changeset
|
44 int mask; |
338 | 45 } VarFilter; |
46 | |
47 typedef struct{ | |
360
c984aa6990f7
Fixes and enhancements from Frank Ranostaj.
Ryan C. Gordon <icculus@icculus.org>
parents:
338
diff
changeset
|
48 Uint8* buffer; |
338 | 49 int mode; |
50 VarFilter *filter; | |
51 } AdapterC; | |
52 | |
380
44ed8bdeba74
More fixes from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
373
diff
changeset
|
53 typedef int (*Adapter) ( AdapterC Data, int length ); |
44ed8bdeba74
More fixes from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
373
diff
changeset
|
54 |
360
c984aa6990f7
Fixes and enhancements from Frank Ranostaj.
Ryan C. Gordon <icculus@icculus.org>
parents:
338
diff
changeset
|
55 typedef struct{ |
373
24a610dfbbfd
More altcvt updates from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
371
diff
changeset
|
56 VarFilter filter; |
420
5b8a07b5162e
Latest altcvt from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
387
diff
changeset
|
57 int filter_index; |
380
44ed8bdeba74
More fixes from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
373
diff
changeset
|
58 Adapter adapter[32]; |
373
24a610dfbbfd
More altcvt updates from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
371
diff
changeset
|
59 /* buffer must be len*len_mult(+len_add) big */ |
24a610dfbbfd
More altcvt updates from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
371
diff
changeset
|
60 int len_mult; |
24a610dfbbfd
More altcvt updates from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
371
diff
changeset
|
61 int len_add; |
24a610dfbbfd
More altcvt updates from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
371
diff
changeset
|
62 double add; |
360
c984aa6990f7
Fixes and enhancements from Frank Ranostaj.
Ryan C. Gordon <icculus@icculus.org>
parents:
338
diff
changeset
|
63 |
373
24a610dfbbfd
More altcvt updates from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
371
diff
changeset
|
64 /* the following elements are provided for compatibility: */ |
24a610dfbbfd
More altcvt updates from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
371
diff
changeset
|
65 /* the size of the output is approx len*len_ratio */ |
24a610dfbbfd
More altcvt updates from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
371
diff
changeset
|
66 double len_ratio; |
24a610dfbbfd
More altcvt updates from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
371
diff
changeset
|
67 Uint8* buf; /* input/output buffer */ |
24a610dfbbfd
More altcvt updates from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
371
diff
changeset
|
68 int needed; /* 0 if nothing to be done, 1 otherwise */ |
24a610dfbbfd
More altcvt updates from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
371
diff
changeset
|
69 int len; /* Length of the input */ |
371 | 70 int len_cvt; /* Length of converted audio buffer */ |
338 | 71 } Sound_AudioCVT; |
72 | |
373
24a610dfbbfd
More altcvt updates from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
371
diff
changeset
|
73 #define SDL_SOUND_Loop 0x10 |
360
c984aa6990f7
Fixes and enhancements from Frank Ranostaj.
Ryan C. Gordon <icculus@icculus.org>
parents:
338
diff
changeset
|
74 |
420
5b8a07b5162e
Latest altcvt from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
387
diff
changeset
|
75 #ifndef SNDDECLSPEC |
5b8a07b5162e
Latest altcvt from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
387
diff
changeset
|
76 #define SNDDECLSPEC DECLSPEC |
5b8a07b5162e
Latest altcvt from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
387
diff
changeset
|
77 #endif |
5b8a07b5162e
Latest altcvt from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
387
diff
changeset
|
78 |
5b8a07b5162e
Latest altcvt from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
387
diff
changeset
|
79 extern SNDDECLSPEC int Sound_AltConvertAudio( Sound_AudioCVT *Data, |
5b8a07b5162e
Latest altcvt from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
387
diff
changeset
|
80 Uint8* buffer, int length, int mode ); |
5b8a07b5162e
Latest altcvt from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
387
diff
changeset
|
81 |
5b8a07b5162e
Latest altcvt from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
387
diff
changeset
|
82 extern SNDDECLSPEC int Sound_AltBuildAudioCVT( Sound_AudioCVT *Data, |
5b8a07b5162e
Latest altcvt from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
387
diff
changeset
|
83 SDL_AudioSpec src, SDL_AudioSpec dst ); |
5b8a07b5162e
Latest altcvt from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
387
diff
changeset
|
84 |
5b8a07b5162e
Latest altcvt from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
387
diff
changeset
|
85 extern SNDDECLSPEC int Sound_estimateBufferSize( Sound_AudioCVT *Data, |
5b8a07b5162e
Latest altcvt from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
387
diff
changeset
|
86 int length ); |
338 | 87 |
366
eda146d666d1
More patches from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
365
diff
changeset
|
88 #endif /* _INCLUDE_AUDIO_CONVERT_H_ */ |
338 | 89 |