medfall

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 8964ba6eeaf5df365f90d6137e7e119c0b12b1c3
parent efecbaa598f00003f125b2abb5fac486cf5ed959
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Sun Nov  1 12:35:04 +0000

Check wav files are using PCM format

Diffstat:
wave.cc | 10+++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/wave.cc b/wave.cc @@ -13,6 +13,10 @@ enum WaveID { WAVEID_data = WAVEID( 'd', 'a', 't', 'a' ), }; +enum WaveFormat { + WAVEFORMAT_PCM = 1, +}; + struct WaveHeader { u32 id_riff; u32 length; @@ -56,7 +60,11 @@ bool wave_decode( MemoryArena * arena, u8 * data, Sound * sound ) { WaveFMT * fmt = ( WaveFMT * ) chunk; - if( ( fmt->num_channels != 1 && fmt->num_channels != 2 ) || fmt->bits_per_sample != 16 ) { + if( + fmt->format != WAVEFORMAT_PCM + || ( fmt->num_channels != 1 && fmt->num_channels != 2 ) + || fmt->bits_per_sample != 16 + ) { return false; }