comparison SDL_sound_internal.h @ 143:3e60862fbd76

Start of audio converter work.
author Ryan C. Gordon <icculus@icculus.org>
date Mon, 15 Oct 2001 21:21:11 +0000
parents 427541211bfd
children 47cc2de2ae36
comparison
equal deleted inserted replaced
142:56f6acdc4ea0 143:3e60862fbd76
92 * in Sound_SampleInternal section: 92 * in Sound_SampleInternal section:
93 * Sound_Sample *next; (offlimits) 93 * Sound_Sample *next; (offlimits)
94 * Sound_Sample *prev; (offlimits) 94 * Sound_Sample *prev; (offlimits)
95 * SDL_RWops *rw; (can use, but do NOT close it) 95 * SDL_RWops *rw; (can use, but do NOT close it)
96 * const Sound_DecoderFunctions *funcs; (that's this structure) 96 * const Sound_DecoderFunctions *funcs; (that's this structure)
97 * SDL_AudioCVT sdlcvt; (offlimits) 97 * Sound_AudioCVT sdlcvt; (offlimits)
98 * void *buffer; (offlimits until read() method) 98 * void *buffer; (offlimits until read() method)
99 * Uint32 buffer_size; (offlimits until read() method) 99 * Uint32 buffer_size; (offlimits until read() method)
100 * void *decoder_private; (read and write access) 100 * void *decoder_private; (read and write access)
101 * 101 *
102 * in rest of Sound_Sample: 102 * in rest of Sound_Sample:
156 */ 156 */
157 Uint32 (*read)(Sound_Sample *sample); 157 Uint32 (*read)(Sound_Sample *sample);
158 } Sound_DecoderFunctions; 158 } Sound_DecoderFunctions;
159 159
160 160
161 /* A structure to hold a set of audio conversion filters and buffers */
162
163 typedef struct Sound_AudioCVT
164 {
165 int needed; /* Set to 1 if conversion possible */
166 Uint16 src_format; /* Source audio format */
167 Uint16 dst_format; /* Target audio format */
168 double rate_incr; /* Rate conversion increment */
169 Uint8 *buf; /* Buffer to hold entire audio data */
170 int len; /* Length of original audio buffer */
171 int len_cvt; /* Length of converted audio buffer */
172 int len_mult; /* buffer must be len*len_mult big */
173 double len_ratio; /* Given len, final size is len*len_ratio */
174 void (*filters[20])(struct Sound_AudioCVT *cvt, Uint16 *format);
175 int filter_index; /* Current audio conversion function */
176 } Sound_AudioCVT;
177
178
161 typedef struct __SOUND_SAMPLEINTERNAL__ 179 typedef struct __SOUND_SAMPLEINTERNAL__
162 { 180 {
163 Sound_Sample *next; 181 Sound_Sample *next;
164 Sound_Sample *prev; 182 Sound_Sample *prev;
165 SDL_RWops *rw; 183 SDL_RWops *rw;
166 const Sound_DecoderFunctions *funcs; 184 const Sound_DecoderFunctions *funcs;
167 SDL_AudioCVT sdlcvt; 185 Sound_AudioCVT sdlcvt;
168 void *buffer; 186 void *buffer;
169 Uint32 buffer_size; 187 Uint32 buffer_size;
170 void *decoder_private; 188 void *decoder_private;
171 } Sound_SampleInternal; 189 } Sound_SampleInternal;
172
173 190
174 191
175 /* error messages... */ 192 /* error messages... */
176 #define ERR_IS_INITIALIZED "Already initialized" 193 #define ERR_IS_INITIALIZED "Already initialized"
177 #define ERR_NOT_INITIALIZED "Not initialized" 194 #define ERR_NOT_INITIALIZED "Not initialized"