comparison include/SDL_audio.h @ 1983:ee73925ddf14

Forgot to check in updated SDL_audio.h ...
author Ryan C. Gordon <icculus@icculus.org>
date Thu, 24 Aug 2006 12:48:16 +0000
parents 01e29c3e9a29
children 8055185ae4ed
comparison
equal deleted inserted replaced
1982:3b4ce57c6215 1983:ee73925ddf14
108 108
109 /* int32 support new to SDL 1.3 */ 109 /* int32 support new to SDL 1.3 */
110 #define AUDIO_S32LSB 0x8020 /* 32-bit integer samples */ 110 #define AUDIO_S32LSB 0x8020 /* 32-bit integer samples */
111 #define AUDIO_S32MSB 0x9020 /* As above, but big-endian byte order */ 111 #define AUDIO_S32MSB 0x9020 /* As above, but big-endian byte order */
112 #define AUDIO_S32 AUDIO_S32LSB 112 #define AUDIO_S32 AUDIO_S32LSB
113 #define AUDIO_U32LSB 0x0020 /* Unsigned 32-bit integer samples */
114 #define AUDIO_U32MSB 0x1020 /* As above, but big-endian byte order */
115 #define AUDIO_U32 AUDIO_U32LSB
116 113
117 /* float32 support new to SDL 1.3 */ 114 /* float32 support new to SDL 1.3 */
118 #define AUDIO_F32LSB 0x8120 /* 32-bit floating point samples */ 115 #define AUDIO_F32LSB 0x8120 /* 32-bit floating point samples */
119 #define AUDIO_F32MSB 0x9120 /* As above, but big-endian byte order */ 116 #define AUDIO_F32MSB 0x9120 /* As above, but big-endian byte order */
120 #define AUDIO_F32 AUDIO_F32LSB 117 #define AUDIO_F32 AUDIO_F32LSB
122 /* Native audio byte ordering */ 119 /* Native audio byte ordering */
123 #if SDL_BYTEORDER == SDL_LIL_ENDIAN 120 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
124 #define AUDIO_U16SYS AUDIO_U16LSB 121 #define AUDIO_U16SYS AUDIO_U16LSB
125 #define AUDIO_S16SYS AUDIO_S16LSB 122 #define AUDIO_S16SYS AUDIO_S16LSB
126 #define AUDIO_S32SYS AUDIO_S32LSB 123 #define AUDIO_S32SYS AUDIO_S32LSB
127 #define AUDIO_U32SYS AUDIO_U32LSB
128 #define AUDIO_F32SYS AUDIO_F32LSB 124 #define AUDIO_F32SYS AUDIO_F32LSB
129 #else 125 #else
130 #define AUDIO_U16SYS AUDIO_U16MSB 126 #define AUDIO_U16SYS AUDIO_U16MSB
131 #define AUDIO_S16SYS AUDIO_S16MSB 127 #define AUDIO_S16SYS AUDIO_S16MSB
132 #define AUDIO_S32SYS AUDIO_S32MSB 128 #define AUDIO_S32SYS AUDIO_S32MSB
133 #define AUDIO_U32SYS AUDIO_U32MSB
134 #define AUDIO_F32SYS AUDIO_F32MSB 129 #define AUDIO_F32SYS AUDIO_F32MSB
135 #endif 130 #endif
136 131
137 132
138 /* A structure to hold a set of audio conversion filters and buffers */ 133 /* A structure to hold a set of audio conversion filters and buffers */
134 struct SDL_AudioCVT;
135 typedef void (SDLCALL * SDL_AudioFilter)(struct SDL_AudioCVT *cvt,
136 SDL_AudioFormat format);
137
139 typedef struct SDL_AudioCVT 138 typedef struct SDL_AudioCVT
140 { 139 {
141 int needed; /* Set to 1 if conversion possible */ 140 int needed; /* Set to 1 if conversion possible */
142 Uint16 src_format; /* Source audio format */ 141 SDL_AudioFormat src_format; /* Source audio format */
143 Uint16 dst_format; /* Target audio format */ 142 SDL_AudioFormat dst_format; /* Target audio format */
144 double rate_incr; /* Rate conversion increment */ 143 double rate_incr; /* Rate conversion increment */
145 Uint8 *buf; /* Buffer to hold entire audio data */ 144 Uint8 *buf; /* Buffer to hold entire audio data */
146 int len; /* Length of original audio buffer */ 145 int len; /* Length of original audio buffer */
147 int len_cvt; /* Length of converted audio buffer */ 146 int len_cvt; /* Length of converted audio buffer */
148 int len_mult; /* buffer must be len*len_mult big */ 147 int len_mult; /* buffer must be len*len_mult big */
149 double len_ratio; /* Given len, final size is len*len_ratio */ 148 double len_ratio; /* Given len, final size is len*len_ratio */
150 void (SDLCALL * filters[10]) (struct SDL_AudioCVT * cvt, Uint16 format); 149 SDL_AudioFilter filters[10]; /* Filter list */
151 int filter_index; /* Current audio conversion function */ 150 int filter_index; /* Current audio conversion function */
152 } SDL_AudioCVT; 151 } SDL_AudioCVT;
153 152
154 153
155 /* Function prototypes */ 154 /* Function prototypes */
156 155
321 * to the other. 320 * to the other.
322 * Returns -1 if the format conversion is not supported, 0 if there's 321 * Returns -1 if the format conversion is not supported, 0 if there's
323 * no conversion needed, or 1 if the audio filter is set up. 322 * no conversion needed, or 1 if the audio filter is set up.
324 */ 323 */
325 extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt, 324 extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
326 Uint16 src_format, 325 SDL_AudioFormat src_format,
327 Uint8 src_channels, 326 Uint8 src_channels,
328 int src_rate, 327 int src_rate,
329 Uint16 dst_format, 328 SDL_AudioFormat dst_format,
330 Uint8 dst_channels, 329 Uint8 dst_channels,
331 int dst_rate); 330 int dst_rate);
332 331
333 /* Once you have initialized the 'cvt' structure using SDL_BuildAudioCVT(), 332 /* Once you have initialized the 'cvt' structure using SDL_BuildAudioCVT(),
334 * created an audio buffer cvt->buf, and filled it with cvt->len bytes of 333 * created an audio buffer cvt->buf, and filled it with cvt->len bytes of