Mercurial > SDL_sound_CoreAudio
annotate alt_audio_convert.h @ 372:ee0678efd4a3
Updated.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Tue, 25 Jun 2002 17:15:29 +0000 |
parents | 1b463ef9bcc2 |
children | 24a610dfbbfd |
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 |
35 | |
36 typedef struct{ | |
366
eda146d666d1
More patches from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
365
diff
changeset
|
37 Sint16 c[16][4*_fsize]; |
371 | 38 Uint8 incr[16]; |
365
f61eadea1f44
More revisions from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
360
diff
changeset
|
39 int denominator; |
f61eadea1f44
More revisions from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
360
diff
changeset
|
40 int numerator; |
338 | 41 } VarFilter; |
42 | |
43 typedef struct{ | |
360
c984aa6990f7
Fixes and enhancements from Frank Ranostaj.
Ryan C. Gordon <icculus@icculus.org>
parents:
338
diff
changeset
|
44 Uint8* buffer; |
338 | 45 int mode; |
46 VarFilter *filter; | |
47 } AdapterC; | |
48 | |
360
c984aa6990f7
Fixes and enhancements from Frank Ranostaj.
Ryan C. Gordon <icculus@icculus.org>
parents:
338
diff
changeset
|
49 /* |
c984aa6990f7
Fixes and enhancements from Frank Ranostaj.
Ryan C. Gordon <icculus@icculus.org>
parents:
338
diff
changeset
|
50 typedef struct{ |
c984aa6990f7
Fixes and enhancements from Frank Ranostaj.
Ryan C. Gordon <icculus@icculus.org>
parents:
338
diff
changeset
|
51 VarFilter filter; |
c984aa6990f7
Fixes and enhancements from Frank Ranostaj.
Ryan C. Gordon <icculus@icculus.org>
parents:
338
diff
changeset
|
52 double mult; // buffer must be len*buf_mult big |
c984aa6990f7
Fixes and enhancements from Frank Ranostaj.
Ryan C. Gordon <icculus@icculus.org>
parents:
338
diff
changeset
|
53 int add; |
c984aa6990f7
Fixes and enhancements from Frank Ranostaj.
Ryan C. Gordon <icculus@icculus.org>
parents:
338
diff
changeset
|
54 int (*adapter[32]) ( AdapterC Data, int length ); |
c984aa6990f7
Fixes and enhancements from Frank Ranostaj.
Ryan C. Gordon <icculus@icculus.org>
parents:
338
diff
changeset
|
55 } SDL_AudioC; |
371 | 56 |
57 */ | |
58 | |
59 /* the len_* variables and the needed variable are not used internally, | |
60 they are provided for compatibility */ | |
360
c984aa6990f7
Fixes and enhancements from Frank Ranostaj.
Ryan C. Gordon <icculus@icculus.org>
parents:
338
diff
changeset
|
61 |
338 | 62 typedef struct{ |
63 int needed; | |
64 VarFilter filter; | |
65 Uint8* buf; | |
371 | 66 int len; /* Length of original audio buffer */ |
67 int len_cvt; /* Length of converted audio buffer */ | |
68 int len_mult; /* buffer must be len*len_mult big */ | |
69 double len_ratio; /* Given len, final size is len*len_ratio */ | |
70 | |
71 double add; | |
72 double mult; | |
338 | 73 int (*adapter[32]) ( AdapterC Data, int length ); |
74 } Sound_AudioCVT; | |
75 | |
360
c984aa6990f7
Fixes and enhancements from Frank Ranostaj.
Ryan C. Gordon <icculus@icculus.org>
parents:
338
diff
changeset
|
76 #define SDL_AI_Loop 0x01 |
c984aa6990f7
Fixes and enhancements from Frank Ranostaj.
Ryan C. Gordon <icculus@icculus.org>
parents:
338
diff
changeset
|
77 |
338 | 78 extern DECLSPEC int Sound_ConvertAudio( Sound_AudioCVT *Data ); |
79 | |
360
c984aa6990f7
Fixes and enhancements from Frank Ranostaj.
Ryan C. Gordon <icculus@icculus.org>
parents:
338
diff
changeset
|
80 extern DECLSPEC int Sound_BuildAudioCVT( Sound_AudioCVT *Data, |
338 | 81 Uint16 src_format, Uint8 src_channels, int src_rate, |
82 Uint16 dst_format, Uint8 dst_channels, int dst_rate ); | |
83 | |
366
eda146d666d1
More patches from Frank.
Ryan C. Gordon <icculus@icculus.org>
parents:
365
diff
changeset
|
84 #endif /* _INCLUDE_AUDIO_CONVERT_H_ */ |
338 | 85 |