diff options
author | Eugene Sandulenko | 2005-10-19 03:29:55 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2005-10-19 03:29:55 +0000 |
commit | 13246d0dadd236fb36eeeb12228e53101cdabc43 (patch) | |
tree | 0ebc8d536809bc82808a52d244eb24e6a4264549 | |
parent | a050da784fd418a3f35cc3fd01e03ce34f33a402 (diff) | |
download | scummvm-rg350-13246d0dadd236fb36eeeb12228e53101cdabc43.tar.gz scummvm-rg350-13246d0dadd236fb36eeeb12228e53101cdabc43.tar.bz2 scummvm-rg350-13246d0dadd236fb36eeeb12228e53101cdabc43.zip |
Attempt to play IMA ADPCM speech in later HE games. For some reason
sound is noisy and all samples are cut in half. mplayer plays it with
same format without any noise but still half sample. It may happen
that original just played 2 consecutive samples or we read them wrong
from resources.
svn-id: r19165
-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-) |