From 78b6cb41a934e6ee47f2891cac4db9f98ec11935 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Fri, 15 Aug 2003 01:21:59 +0000 Subject: patch #788078 Improved Amiga V3 SFX support by Quietust svn-id: r9695 --- scumm/sound.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'scumm') 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) -- cgit v1.2.3