Skip to content

Commit

Permalink
Fixed bug 1673 - BEXT wave files only have extra metadata that you ca…
Browse files Browse the repository at this point in the history
…n easily skip through

bill

In SDL_wave.c, BEXT wave files with "bext" instead of "fmt " are choked on

if (chunk.magic != FMT) {
    SDL_SetError("Complex WAVE files not supported");
    was_error = 1;
    goto done;
}

BEXT files http://en.wikipedia.org/wiki/Broadcast_Wave_Format actually playback the same as regular waves. All they have is (A LOT OF) extra header info.

To open them, just SKIP the "bext" chunk, and the "fmt " chunk will be a couple of hundred bytes later.

The "fmt " chunk is also bloated, but if you skip past the extra information to the "data" chunk, there is nothing different about a BEXT wave file than a "normal" one.

You can then load the data and proceed as normal.
  • Loading branch information
slouken committed Jun 22, 2014
1 parent 2f9c708 commit ad40547
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions wavestream.c
Expand Up @@ -49,7 +49,8 @@
#define WAVE 0x45564157 /* "WAVE" */
#define FACT 0x74636166 /* "fact" */
#define LIST 0x5453494c /* "LIST" */
#define FMT 0x20746D66 /* "fmt " */
#define BEXT 0x74786562 /* "bext" */
#define FMT 0x20746D66 /* "fmt " */
#define DATA 0x61746164 /* "data" */
#define PCM_CODE 1
#define ADPCM_CODE 2
Expand Down Expand Up @@ -304,7 +305,7 @@ static SDL_RWops *LoadWAVStream (SDL_RWops *src, SDL_AudioSpec *spec,
was_error = 1;
goto done;
}
} while ( (chunk.magic == FACT) || (chunk.magic == LIST) );
} while ((chunk.magic == FACT) || (chunk.magic == LIST) || (chunk.magic == BEXT));

/* Decode the audio data format */
format = (WaveFMT *)chunk.data;
Expand Down

0 comments on commit ad40547

Please sign in to comment.