aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gray2003-08-15 01:21:59 +0000
committerJonathan Gray2003-08-15 01:21:59 +0000
commit78b6cb41a934e6ee47f2891cac4db9f98ec11935 (patch)
tree93823a172cf0780d52006eea30849069f21fb949
parentc258337b27b0f8e339f9f7ccba30f803537f2372 (diff)
downloadscummvm-rg350-78b6cb41a934e6ee47f2891cac4db9f98ec11935.tar.gz
scummvm-rg350-78b6cb41a934e6ee47f2891cac4db9f98ec11935.tar.bz2
scummvm-rg350-78b6cb41a934e6ee47f2891cac4db9f98ec11935.zip
patch #788078 Improved Amiga V3 SFX support by Quietust
svn-id: r9695
-rw-r--r--scumm/sound.cpp30
1 files changed, 16 insertions, 14 deletions
diff --git a/scumm/sound.cpp b/scumm/sound.cpp
index 280ce0e5eb..71e6deab6f 100644
--- a/scumm/sound.cpp
+++ b/scumm/sound.cpp
@@ -433,23 +433,22 @@ void Sound::playSound(int soundID) {
return;
}
- if ((_scumm->_features & GF_AMIGA) && (_scumm->_version == 3))
- {
- // experimental support for Indy3 Amiga sound effects
- if (READ_BE_UINT16(ptr + 26) == 0x00FF) // looped sound
- // TODO: support looping sounds
- // ptr + 14 seems to be looping duration
- flags = 0;
- else if (READ_BE_UINT16(ptr + 26) == 0x0001) // nonlooped sound
- flags = 0; //
- else if (READ_BE_UINT16(ptr + 26) == 0x0101) // background music
- // TODO: support music
+ if ((_scumm->_features & GF_AMIGA) && (_scumm->_version == 3)) {
+ if (READ_BE_UINT16(ptr + 26) & 0x0100) {
+ // TODO: support Amiga music
return;
+ }
size = READ_BE_UINT16(ptr + 12);
rate = 11000;
sound = (char *)malloc(size);
- memcpy(sound,ptr + 28,size);
- _scumm->_mixer->playRaw(NULL, sound, size, rate, SoundMixer::FLAG_AUTOFREE, soundID);
+ memcpy(sound,ptr + READ_BE_UINT16(ptr + 8),size);
+ if (READ_BE_UINT16(ptr + 16) || READ_BE_UINT16(ptr + 6)) {
+ // the first check is for pitch-bending looped sounds (i.e. "pouring liquid", "biplane dive", etc.)
+ // the second check is for simple looped sounds
+ _scumm->_mixer->playRaw(NULL,sound,size,rate,SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_LOOP,soundID,READ_BE_UINT16(ptr + 10) - READ_BE_UINT16(ptr + 8),READ_BE_UINT16(ptr + 14));
+ } else {
+ _scumm->_mixer->playRaw(NULL,sound,size,rate,SoundMixer::FLAG_AUTOFREE,soundID);
+ }
return;
}
@@ -746,7 +745,10 @@ void Sound::stopSound(int a) {
_scumm->_imuse->stopSound(a);
} else if (_scumm->_playerV2) {
_scumm->_playerV2->stopSound (a);
- }
+ } else if ((_scumm->_features & GF_AMIGA) && (_scumm->_version == 3)) {
+ // this handles stopping looped sounds for now
+ _scumm->_mixer->stopID(a);
+ }
for (i = 0; i < 10; i++)
if (_soundQue2[i] == a)