aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorTravis Howell2006-03-19 04:55:34 +0000
committerTravis Howell2006-03-19 04:55:34 +0000
commita441dafae55bcd02d74f16c35ff19db3f84c958c (patch)
tree9a5d8a9e670e00cfe7d36c080c621f817e05244b /engines
parent1b20b068220b30967cfdd290365014ab81c12a1f (diff)
downloadscummvm-rg350-a441dafae55bcd02d74f16c35ff19db3f84c958c.tar.gz
scummvm-rg350-a441dafae55bcd02d74f16c35ff19db3f84c958c.tar.bz2
scummvm-rg350-a441dafae55bcd02d74f16c35ff19db3f84c958c.zip
Move the sound loop detection, so it is used by all HE70+ games
svn-id: r21374
Diffstat (limited to 'engines')
-rw-r--r--engines/scumm/he/sound_he.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/engines/scumm/he/sound_he.cpp b/engines/scumm/he/sound_he.cpp
index 5f162defb0..873e6ef77e 100644
--- a/engines/scumm/he/sound_he.cpp
+++ b/engines/scumm/he/sound_he.cpp
@@ -370,11 +370,11 @@ void Sound::playHESound(int soundID, int heOffset, int heChannel, int heFlags) {
strcpy(buf, buf1);
}
if (musicFile.open(buf) == false) {
- warning("playSound: Can't open music file %s", buf);
+ warning("playHESound: Can't open music file %s", buf);
return;
}
if (!getHEMusicDetails(soundID, music_offs, size)) {
- debug(0, "playSound: musicID %d not found", soundID);
+ debug(0, "playHESound: musicID %d not found", soundID);
return;
}
@@ -402,11 +402,6 @@ void Sound::playHESound(int soundID, int heOffset, int heChannel, int heFlags) {
return;
}
- // TODO: Extra sound flags
- if (heFlags & 1) {
- flags |= Audio::Mixer::FLAG_LOOP;
- }
-
// Support for sound in later Backyard sports games
if (READ_BE_UINT32(ptr) == MKID_BE('RIFF') || READ_BE_UINT32(ptr) == MKID_BE('WSOU')) {
uint16 compType;
@@ -420,7 +415,7 @@ void Sound::playHESound(int soundID, int heOffset, int heChannel, int heFlags) {
Common::MemoryReadStream stream(ptr, size);
if (!loadWAVFromStream(stream, size, rate, flags, &compType, &blockAlign)) {
- error("playSound: Not a valid WAV file");
+ error("playHESound: Not a valid WAV file (%d)", soundID);
}
if (compType == 17) {
@@ -435,6 +430,12 @@ void Sound::playHESound(int soundID, int heOffset, int heChannel, int heFlags) {
sound = (char *)malloc(size);
memcpy(sound, ptr + stream.pos(), size);
}
+
+ // TODO: Extra sound flags
+ if (heFlags & 1) {
+ flags |= Audio::Mixer::FLAG_LOOP;
+ }
+
_vm->_mixer->stopHandle(_heSoundChannels[heChannel]);
_vm->_mixer->playRaw(&_heSoundChannels[heChannel], sound, size, rate, flags, soundID, 255, 0, 0,0, type);
}
@@ -466,7 +467,6 @@ void Sound::playHESound(int soundID, int heOffset, int heChannel, int heFlags) {
size = READ_BE_UINT32(ptr + 4) - 8;
if (heOffset < 0 || heOffset > size) {
// Occurs when making fireworks in puttmoon
- debug(0, "playSound: Invalid sound offset (offset %d, size %d) in sound %d", heOffset, size, soundID);
heOffset = 0;
}
size -= heOffset;
@@ -477,6 +477,11 @@ void Sound::playHESound(int soundID, int heOffset, int heChannel, int heFlags) {
_overrideFreq = 0;
}
+ // TODO: Extra sound flags
+ if (heFlags & 1) {
+ flags |= Audio::Mixer::FLAG_LOOP;
+ }
+
_vm->_mixer->stopHandle(_heSoundChannels[heChannel]);
_vm->_mixer->playRaw(&_heSoundChannels[heChannel], ptr + heOffset + 8, size, rate, flags, soundID, 255, 0, 0,0, type);