Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
More streamer work.
Browse files Browse the repository at this point in the history
  • Loading branch information
schnarf committed Aug 12, 2008
1 parent e54703b commit 96735b8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
6 changes: 4 additions & 2 deletions src/audio/SDL_audio.c
Expand Up @@ -282,7 +282,7 @@ int SDL_StreamLength(SDL_AudioStreamer * stream) {
}

/* 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 */
Expand All @@ -297,7 +297,7 @@ int SDL_StreamInit(SDL_AudioStreamer * stream, int max_len) {

/* Zero out the buffer */
for(i = 0; i < max_len; ++i) {
stream->buffer[i] = 0;
stream->buffer[i] = silence;
}
}

Expand Down Expand Up @@ -339,6 +339,8 @@ SDL_RunAudio(void *devicep)
silence = device->spec.silence;
stream_len = device->spec.size;
}

/* Determine if the streamer is necessary here */

/* Loop, filling the audio buffers */
while (device->enabled) {
Expand Down
8 changes: 0 additions & 8 deletions src/audio/SDL_audio_c.h
Expand Up @@ -42,12 +42,4 @@ typedef struct
} 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: */
12 changes: 12 additions & 0 deletions src/audio/SDL_sysaudio.h
Expand Up @@ -68,6 +68,14 @@ typedef struct SDL_AudioDriver
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
Expand All @@ -80,6 +88,10 @@ struct SDL_AudioDevice

/* 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;
Expand Down

0 comments on commit 96735b8

Please sign in to comment.