comparison src/audio/SDL_audio.c @ 4472:791b3256fb22

Mostly cleaned up warnings with -Wmissing-prototypes
author Sam Lantinga <slouken@libsdl.org>
date Sat, 26 Jun 2010 08:56:48 -0700
parents 4160ba33b597
children dbf3fa541096
comparison
equal deleted inserted replaced
4471:11cedc036ca1 4472:791b3256fb22
255 #undef FILL_STUB 255 #undef FILL_STUB
256 } 256 }
257 257
258 /* Streaming functions (for when the input and output buffer sizes are different) */ 258 /* Streaming functions (for when the input and output buffer sizes are different) */
259 /* Write [length] bytes from buf into the streamer */ 259 /* Write [length] bytes from buf into the streamer */
260 void 260 static void
261 SDL_StreamWrite(SDL_AudioStreamer * stream, Uint8 * buf, int length) 261 SDL_StreamWrite(SDL_AudioStreamer * stream, Uint8 * buf, int length)
262 { 262 {
263 int i; 263 int i;
264 264
265 for (i = 0; i < length; ++i) { 265 for (i = 0; i < length; ++i) {
267 ++stream->write_pos; 267 ++stream->write_pos;
268 } 268 }
269 } 269 }
270 270
271 /* Read [length] bytes out of the streamer into buf */ 271 /* Read [length] bytes out of the streamer into buf */
272 void 272 static void
273 SDL_StreamRead(SDL_AudioStreamer * stream, Uint8 * buf, int length) 273 SDL_StreamRead(SDL_AudioStreamer * stream, Uint8 * buf, int length)
274 { 274 {
275 int i; 275 int i;
276 276
277 for (i = 0; i < length; ++i) { 277 for (i = 0; i < length; ++i) {
278 buf[i] = stream->buffer[stream->read_pos]; 278 buf[i] = stream->buffer[stream->read_pos];
279 ++stream->read_pos; 279 ++stream->read_pos;
280 } 280 }
281 } 281 }
282 282
283 int 283 static int
284 SDL_StreamLength(SDL_AudioStreamer * stream) 284 SDL_StreamLength(SDL_AudioStreamer * stream)
285 { 285 {
286 return (stream->write_pos - stream->read_pos) % stream->max_len; 286 return (stream->write_pos - stream->read_pos) % stream->max_len;
287 } 287 }
288 288
289 /* Initialize the stream by allocating the buffer and setting the read/write heads to the beginning */ 289 /* Initialize the stream by allocating the buffer and setting the read/write heads to the beginning */
290 int 290 static int
291 SDL_StreamInit(SDL_AudioStreamer * stream, int max_len, Uint8 silence) 291 SDL_StreamInit(SDL_AudioStreamer * stream, int max_len, Uint8 silence)
292 { 292 {
293 /* First try to allocate the buffer */ 293 /* First try to allocate the buffer */
294 stream->buffer = (Uint8 *) SDL_malloc(max_len); 294 stream->buffer = (Uint8 *) SDL_malloc(max_len);
295 if (stream->buffer == NULL) { 295 if (stream->buffer == NULL) {
305 305
306 return 0; 306 return 0;
307 } 307 }
308 308
309 /* Deinitialize the stream simply by freeing the buffer */ 309 /* Deinitialize the stream simply by freeing the buffer */
310 void 310 static void
311 SDL_StreamDeinit(SDL_AudioStreamer * stream) 311 SDL_StreamDeinit(SDL_AudioStreamer * stream)
312 { 312 {
313 if (stream->buffer != NULL) { 313 if (stream->buffer != NULL) {
314 SDL_free(stream->buffer); 314 SDL_free(stream->buffer);
315 } 315 }