More streamer work. gsoc2008_audio_resampling
authorAaron Wishnick
Tue, 12 Aug 2008 01:03:05 +0000
branchgsoc2008_audio_resampling
changeset 2665f39a056aec8b
parent 2664 344c8da164f4
child 2666 e12ccc6c9576
More streamer work.
src/audio/SDL_audio.c
src/audio/SDL_audio_c.h
src/audio/SDL_sysaudio.h
     1.1 --- a/src/audio/SDL_audio.c	Tue Aug 12 00:50:58 2008 +0000
     1.2 +++ b/src/audio/SDL_audio.c	Tue Aug 12 01:03:05 2008 +0000
     1.3 @@ -282,7 +282,7 @@
     1.4  }
     1.5  
     1.6  /* Initialize the stream by allocating the buffer and setting the read/write heads to the beginning */
     1.7 -int SDL_StreamInit(SDL_AudioStreamer * stream, int max_len) {
     1.8 +int SDL_StreamInit(SDL_AudioStreamer * stream, int max_len, Uint8 silence) {
     1.9  	int i;
    1.10  
    1.11  	/* First try to allocate the buffer */
    1.12 @@ -297,7 +297,7 @@
    1.13  	
    1.14  	/* Zero out the buffer */
    1.15  	for(i = 0; i < max_len; ++i) {
    1.16 -		stream->buffer[i] = 0;
    1.17 +		stream->buffer[i] = silence;
    1.18  	}
    1.19  }
    1.20  
    1.21 @@ -339,6 +339,8 @@
    1.22          silence = device->spec.silence;
    1.23          stream_len = device->spec.size;
    1.24      }
    1.25 +	
    1.26 +	/* Determine if the streamer is necessary here */
    1.27  
    1.28      /* Loop, filling the audio buffers */
    1.29      while (device->enabled) {
     2.1 --- a/src/audio/SDL_audio_c.h	Tue Aug 12 00:50:58 2008 +0000
     2.2 +++ b/src/audio/SDL_audio_c.h	Tue Aug 12 01:03:05 2008 +0000
     2.3 @@ -42,12 +42,4 @@
     2.4  } SDL_AudioTypeFilters;
     2.5  extern const SDL_AudioTypeFilters sdl_audio_type_filters[];
     2.6  
     2.7 -/* Streamer */
     2.8 -typedef struct
     2.9 -{
    2.10 -	Uint8 *buffer;
    2.11 -	int max_len;				// the maximum length in bytes
    2.12 -	int read_pos, write_pos;	// the position of the write and read heads in bytes
    2.13 -} SDL_AudioStreamer;
    2.14 -
    2.15  /* vi: set ts=4 sw=4 expandtab: */
     3.1 --- a/src/audio/SDL_sysaudio.h	Tue Aug 12 00:50:58 2008 +0000
     3.2 +++ b/src/audio/SDL_sysaudio.h	Tue Aug 12 01:03:05 2008 +0000
     3.3 @@ -68,6 +68,14 @@
     3.4      SDL_AudioDriverImpl impl;
     3.5  } SDL_AudioDriver;
     3.6  
     3.7 +/* Streamer */
     3.8 +typedef struct
     3.9 +{
    3.10 +	Uint8 *buffer;
    3.11 +	int max_len;				/* the maximum length in bytes */
    3.12 +	int read_pos, write_pos;	/* the position of the write and read heads in bytes */
    3.13 +} SDL_AudioStreamer;
    3.14 +
    3.15  
    3.16  /* Define the SDL audio driver structure */
    3.17  struct SDL_AudioDevice
    3.18 @@ -80,6 +88,10 @@
    3.19  
    3.20      /* An audio conversion block for audio format emulation */
    3.21      SDL_AudioCVT convert;
    3.22 +	
    3.23 +	/* The streamer, if sample rate conversion necessitates it */
    3.24 +	int use_streamer;
    3.25 +	SDL_AudioStreamer streamer;
    3.26  
    3.27      /* Current state flags */
    3.28      int iscapture;