aboutsummaryrefslogtreecommitdiff
path: root/engines/agos
diff options
context:
space:
mode:
authorMax Horn2009-10-14 22:37:05 +0000
committerMax Horn2009-10-14 22:37:05 +0000
commit6a2985ba08fc030d93d625615d7b1b5604fbc98c (patch)
treee25a72cfb73129ded78f0b72269778b7f98fe868 /engines/agos
parenta7e6f50ede79a0f7f1ca89ae6900d838cf4fe334 (diff)
downloadscummvm-rg350-6a2985ba08fc030d93d625615d7b1b5604fbc98c.tar.gz
scummvm-rg350-6a2985ba08fc030d93d625615d7b1b5604fbc98c.tar.bz2
scummvm-rg350-6a2985ba08fc030d93d625615d7b1b5604fbc98c.zip
Patch #2834677: Wave/ADPCM Endianness Fixes
svn-id: r45095
Diffstat (limited to 'engines/agos')
-rw-r--r--engines/agos/animation.cpp11
-rw-r--r--engines/agos/sound.cpp25
2 files changed, 4 insertions, 32 deletions
diff --git a/engines/agos/animation.cpp b/engines/agos/animation.cpp
index efcd78e482..e2511f335f 100644
--- a/engines/agos/animation.cpp
+++ b/engines/agos/animation.cpp
@@ -282,7 +282,6 @@ void MoviePlayerDXA::stopVideo() {
}
void MoviePlayerDXA::startSound() {
- byte *buffer;
uint32 offset, size;
if (getSoundTag() == MKID_BE('WAVE')) {
@@ -302,18 +301,12 @@ void MoviePlayerDXA::startSound() {
offset = in.readUint32LE();
size = in.readUint32LE();
- buffer = (byte *)malloc(size);
in.seek(offset, SEEK_SET);
- in.read(buffer, size);
+ _bgSoundStream = Audio::makeWAVStream(in.readStream(size), true);
in.close();
} else {
- buffer = (byte *)malloc(size);
- _fileStream->read(buffer, size);
+ _bgSoundStream = Audio::makeWAVStream(_fileStream->readStream(size), true);
}
-
- Common::MemoryReadStream stream(buffer, size);
- _bgSoundStream = Audio::makeWAVStream(&stream, false);
- free(buffer);
} else {
_bgSoundStream = Audio::AudioStream::openStreamFile(baseName);
}
diff --git a/engines/agos/sound.cpp b/engines/agos/sound.cpp
index 3008442ed2..b93dce62a2 100644
--- a/engines/agos/sound.cpp
+++ b/engines/agos/sound.cpp
@@ -31,7 +31,6 @@
#include "agos/agos.h"
#include "agos/sound.h"
-#include "sound/adpcm.h"
#include "sound/audiostream.h"
#include "sound/flac.h"
#include "sound/mixer.h"
@@ -782,34 +781,14 @@ void Sound::playVoiceData(byte *soundData, uint sound) {
}
void Sound::playSoundData(Audio::SoundHandle *handle, byte *soundData, uint sound, int pan, int vol, bool loop) {
- byte *buffer, flags;
- uint16 compType;
- int blockAlign, rate;
-
- // TODO: Use makeWAVStream() in future, when makeADPCMStream() allows sound looping
int size = READ_LE_UINT32(soundData + 4);
Common::MemoryReadStream stream(soundData, size);
- if (!Audio::loadWAVFromStream(stream, size, rate, flags, &compType, &blockAlign))
- error("playSoundData: Not a valid WAV data");
+ Audio::AudioStream *sndStream = Audio::makeWAVStream(&stream, true, loop);
convertVolume(vol);
convertPan(pan);
- if (loop == true)
- flags |= Audio::Mixer::FLAG_LOOP;
-
- if (compType == 2) {
- Audio::AudioStream *sndStream = Audio::makeADPCMStream(&stream, false, size, Audio::kADPCMMS, rate, (flags & Audio::Mixer::FLAG_STEREO) ? 2 : 1, blockAlign);
- buffer = (byte *)malloc(size * 4);
- size = sndStream->readBuffer((int16*)buffer, size * 2);
- size *= 2; // 16bits.
- delete sndStream;
- } else {
- buffer = (byte *)malloc(size);
- memcpy(buffer, soundData + stream.pos(), size);
- }
-
- _mixer->playRaw(Audio::Mixer::kSFXSoundType, handle, buffer, size, rate, flags | Audio::Mixer::FLAG_AUTOFREE, -1, vol, pan);
+ _mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, sndStream, -1, vol, pan);
}
void Sound::stopSfx5() {