# HG changeset patch # User Aaron Wishnick # Date 1218502985 0 # Node ID f39a056aec8b872e58a5d636005eb8682c0755dd # Parent 344c8da164f49b7d6cd26df92b498fe7e3971727 More streamer work. diff -r 344c8da164f4 -r f39a056aec8b src/audio/SDL_audio.c --- a/src/audio/SDL_audio.c Tue Aug 12 00:50:58 2008 +0000 +++ b/src/audio/SDL_audio.c Tue Aug 12 01:03:05 2008 +0000 @@ -282,7 +282,7 @@ } /* Initialize the stream by allocating the buffer and setting the read/write heads to the beginning */ -int SDL_StreamInit(SDL_AudioStreamer * stream, int max_len) { +int SDL_StreamInit(SDL_AudioStreamer * stream, int max_len, Uint8 silence) { int i; /* First try to allocate the buffer */ @@ -297,7 +297,7 @@ /* Zero out the buffer */ for(i = 0; i < max_len; ++i) { - stream->buffer[i] = 0; + stream->buffer[i] = silence; } } @@ -339,6 +339,8 @@ silence = device->spec.silence; stream_len = device->spec.size; } + + /* Determine if the streamer is necessary here */ /* Loop, filling the audio buffers */ while (device->enabled) { diff -r 344c8da164f4 -r f39a056aec8b src/audio/SDL_audio_c.h --- a/src/audio/SDL_audio_c.h Tue Aug 12 00:50:58 2008 +0000 +++ b/src/audio/SDL_audio_c.h Tue Aug 12 01:03:05 2008 +0000 @@ -42,12 +42,4 @@ } SDL_AudioTypeFilters; extern const SDL_AudioTypeFilters sdl_audio_type_filters[]; -/* Streamer */ -typedef struct -{ - Uint8 *buffer; - int max_len; // the maximum length in bytes - int read_pos, write_pos; // the position of the write and read heads in bytes -} SDL_AudioStreamer; - /* vi: set ts=4 sw=4 expandtab: */ diff -r 344c8da164f4 -r f39a056aec8b src/audio/SDL_sysaudio.h --- a/src/audio/SDL_sysaudio.h Tue Aug 12 00:50:58 2008 +0000 +++ b/src/audio/SDL_sysaudio.h Tue Aug 12 01:03:05 2008 +0000 @@ -68,6 +68,14 @@ SDL_AudioDriverImpl impl; } SDL_AudioDriver; +/* Streamer */ +typedef struct +{ + Uint8 *buffer; + int max_len; /* the maximum length in bytes */ + int read_pos, write_pos; /* the position of the write and read heads in bytes */ +} SDL_AudioStreamer; + /* Define the SDL audio driver structure */ struct SDL_AudioDevice @@ -80,6 +88,10 @@ /* An audio conversion block for audio format emulation */ SDL_AudioCVT convert; + + /* The streamer, if sample rate conversion necessitates it */ + int use_streamer; + SDL_AudioStreamer streamer; /* Current state flags */ int iscapture;