diff options
-rw-r--r-- | scumm/sound.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/scumm/sound.cpp b/scumm/sound.cpp index cad5d5b8b4..4cbea0ebce 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -33,6 +33,7 @@ #include "common/timer.h" #include "common/util.h" +#include "sound/adpcm.h" #include "sound/audiocd.h" #include "sound/flac.h" #include "sound/mididrv.h" @@ -306,16 +307,24 @@ void Sound::playSound(int soundID, int heOffset, int heChannel, int heFlags) { } // Support for later Backyard sports games sounds else if (READ_UINT32(ptr) == MKID('RIFF')) { - size = READ_BE_UINT32(ptr + 4); + uint16 type; + size = READ_LE_UINT32(ptr + 4); Common::MemoryReadStream stream(ptr, size); - if (!loadWAVFromStream(stream, size, rate, flags)) { + if (!loadWAVFromStream(stream, size, rate, flags, &type)) { error("playSound: Not a valid WAV file"); } - // Allocate a sound buffer, copy the data into it, and play - sound = (char *)malloc(size); - memcpy(sound, ptr + stream.pos(), size); + if (type == 17) { + AudioStream *voxStream = makeADPCMStream(stream, size, kADPCMIma); + + sound = (char *)malloc(size * 2); + size = voxStream->readBuffer((int16*)sound, size * 2); + } else { + // Allocate a sound buffer, copy the data into it, and play + sound = (char *)malloc(size); + memcpy(sound, ptr + stream.pos(), size); + } _vm->_mixer->playRaw(&_heSoundChannels[heChannel], sound, size, rate, flags, soundID); } // Support for Putt-Putt sounds - very hackish, too 8-) |