Skip to content

Commit

Permalink
Moved detect_music_type() into the Mix_LoadMusic_RW() function
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Oct 5, 2019
1 parent 52845d1 commit 2301b7a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mixer.c
Expand Up @@ -527,9 +527,10 @@ typedef struct _MusicFragment
struct _MusicFragment *next;
} MusicFragment;

static SDL_AudioSpec *Mix_LoadMusic_RW(Mix_MusicType music_type, SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len)
static SDL_AudioSpec *Mix_LoadMusic_RW(SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len)
{
int i;
Mix_MusicType music_type;
Mix_MusicInterface *interface = NULL;
void *music = NULL;
Sint64 start;
Expand All @@ -538,6 +539,7 @@ static SDL_AudioSpec *Mix_LoadMusic_RW(Mix_MusicType music_type, SDL_RWops *src,
int count = 0;
int fragment_size;

music_type = detect_music_type(src);
if (!load_music_type(music_type) || !open_music_type(music_type)) {
return NULL;
}
Expand Down Expand Up @@ -720,7 +722,7 @@ Mix_Chunk *Mix_LoadWAV_RW(SDL_RWops *src, int freesrc)
} else if (SDL_memcmp(magic, "Crea", 4) == 0) {
loaded = Mix_LoadVOC_RW(src, freesrc, &wavespec, (Uint8 **)&chunk->abuf, &chunk->alen);
} else {
loaded = Mix_LoadMusic_RW(detect_music_type(src), src, freesrc, &wavespec, (Uint8 **)&chunk->abuf, &chunk->alen);
loaded = Mix_LoadMusic_RW(src, freesrc, &wavespec, (Uint8 **)&chunk->abuf, &chunk->alen);
}
if (!loaded) {
/* The individual loaders have closed src if needed */
Expand Down

0 comments on commit 2301b7a

Please sign in to comment.