338
|
1 /*
|
|
2 Extended Audio Converter for SDL (Simple DirectMedia Layer)
|
|
3 Copyright (C) 2002 Frank Ranostaj
|
|
4 Institute of Applied Physik
|
|
5 Johann Wolfgang Goethe-Universität
|
|
6 Frankfurt am Main, Germany
|
|
7
|
|
8 This library is free software; you can redistribute it and/or
|
|
9 modify it under the terms of the GNU Library General Public
|
|
10 License as published by the Free Software Foundation; either
|
|
11 version 2 of the License, or (at your option) any later version.
|
|
12
|
|
13 This library is distributed in the hope that it will be useful,
|
|
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
16 Library General Public License for more details.
|
|
17
|
|
18 You should have received a copy of the GNU Library General Public
|
|
19 License along with this library; if not, write to the Free
|
|
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
21
|
|
22 Frank Ranostaj
|
|
23 ranostaj@stud.uni-frankfurt.de
|
|
24
|
|
25 (This code blatantly abducted for SDL_sound. Thanks, Frank! --ryan.)
|
|
26
|
|
27 */
|
|
28
|
|
29 #ifndef _INCLUDE_AUDIO_CONVERT_H_
|
|
30 #define _INCLUDE_AUDIO_CONVERT_H_
|
|
31
|
|
32 #include "SDL_audio.h"
|
|
33 #define Sound_AI_Loop 0x2
|
|
34 #define _fsize 64
|
|
35
|
|
36
|
|
37 typedef struct{
|
|
38 short c[16][2*_fsize];
|
|
39 char incr[16];
|
|
40 int pos_mod;
|
|
41 } VarFilter;
|
|
42
|
|
43 typedef struct{
|
|
44 short* buffer;
|
|
45 int mode;
|
|
46 VarFilter *filter;
|
|
47 } AdapterC;
|
|
48
|
|
49 typedef struct{
|
|
50 int needed;
|
|
51 VarFilter filter;
|
|
52 double len_mult; /* buffer must be len*len_mult big*/
|
|
53 Uint8* buf;
|
|
54 int len;
|
|
55 int len_cvt; /* Length of converted audio buffer */
|
|
56 int add;
|
|
57 int (*adapter[32]) ( AdapterC Data, int length );
|
|
58 } Sound_AudioCVT;
|
|
59
|
|
60 extern DECLSPEC int Sound_ConvertAudio( Sound_AudioCVT *Data );
|
|
61
|
|
62 extern DECLSPEC int Sound_BuildAudioConverter( Sound_AudioCVT *Data,
|
|
63 Uint16 src_format, Uint8 src_channels, int src_rate,
|
|
64 Uint16 dst_format, Uint8 dst_channels, int dst_rate );
|
|
65
|
|
66 #endif /* _INCLUDE_AUDIO_CONVERT_H_ */
|
|
67
|