Skip to content

Commit

Permalink
Removed references to Sound_AudioCVT. Just use SDL's for now.
Browse files Browse the repository at this point in the history
Eventually this should use an SDL_AudioStream instead.
  • Loading branch information
icculus committed Jul 14, 2018
1 parent 6058484 commit 5be970a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 30 deletions.
7 changes: 3 additions & 4 deletions src/SDL_sound.c
Expand Up @@ -456,14 +456,13 @@ static int init_sample(const Sound_DecoderFunctions *funcs,
if (desired.rate == 0)
desired.rate = sample->actual.rate;

if (Sound_BuildAudioCVT(&internal->sdlcvt,
if (SDL_BuildAudioCVT(&internal->sdlcvt,
sample->actual.format,
sample->actual.channels,
sample->actual.rate,
desired.format,
desired.channels,
desired.rate,
sample->buffer_size) == -1)
desired.rate) == -1)
{
__Sound_SetError(SDL_GetError());
funcs->close(sample);
Expand Down Expand Up @@ -736,7 +735,7 @@ Uint32 Sound_Decode(Sound_Sample *sample)
if (retval > 0 && internal->sdlcvt.needed)
{
internal->sdlcvt.len = retval;
Sound_ConvertAudio(&internal->sdlcvt);
SDL_ConvertAudio(&internal->sdlcvt);
retval = internal->sdlcvt.len_cvt;
} /* if */

Expand Down
28 changes: 2 additions & 26 deletions src/SDL_sound_internal.h
Expand Up @@ -154,7 +154,7 @@ typedef struct __SOUND_DECODERFUNCTIONS__
* Sound_Sample *prev; (offlimits)
* SDL_RWops *rw; (can use, but do NOT close it)
* const Sound_DecoderFunctions *funcs; (that's this structure)
* Sound_AudioCVT sdlcvt; (offlimits)
* SDL_AudioCVT sdlcvt; (offlimits)
* void *buffer; (offlimits until read() method)
* Uint32 buffer_size; (offlimits until read() method)
* void *decoder_private; (read and write access)
Expand Down Expand Up @@ -252,30 +252,6 @@ typedef struct __SOUND_DECODERFUNCTIONS__
} Sound_DecoderFunctions;


/* A structure to hold a set of audio conversion filters and buffers */
typedef struct Sound_AudioCVT
{
int needed; /* Set to 1 if conversion possible */
Uint16 src_format; /* Source audio format */
Uint16 dst_format; /* Target audio format */
double rate_incr; /* Rate conversion increment */
Uint8 *buf; /* Buffer to hold entire audio data */
int len; /* Length of original audio buffer */
int len_cvt; /* Length of converted audio buffer */
int len_mult; /* buffer must be len*len_mult big */
double len_ratio; /* Given len, final size is len*len_ratio */
void (*filters[20])(struct Sound_AudioCVT *cvt, Uint16 *format);
int filter_index; /* Current audio conversion function */
} Sound_AudioCVT;

extern SNDDECLSPEC int Sound_BuildAudioCVT(Sound_AudioCVT *cvt,
Uint16 src_format, Uint8 src_channels, Uint32 src_rate,
Uint16 dst_format, Uint8 dst_channels, Uint32 dst_rate,
Uint32 dst_size);

extern SNDDECLSPEC int Sound_ConvertAudio(Sound_AudioCVT *cvt);


typedef void (*MixFunc)(float *dst, void *src, Uint32 frames, float *gains);

typedef struct __SOUND_SAMPLEINTERNAL__
Expand All @@ -284,7 +260,7 @@ typedef struct __SOUND_SAMPLEINTERNAL__
Sound_Sample *prev;
SDL_RWops *rw;
const Sound_DecoderFunctions *funcs;
Sound_AudioCVT sdlcvt;
SDL_AudioCVT sdlcvt;
void *buffer;
Uint32 buffer_size;
void *decoder_private;
Expand Down

0 comments on commit 5be970a

Please sign in to comment.