diff options
author | James Brown | 2003-07-04 14:10:44 +0000 |
---|---|---|
committer | James Brown | 2003-07-04 14:10:44 +0000 |
commit | 093a31839beca7897032c245ca009da8de7a43d4 (patch) | |
tree | efd519b10abff021f3ead6108dc3c22dba6ddb17 /scumm | |
parent | 0ed8e1ef36ae8d30edab9d4d74481ffac01f39b4 (diff) | |
download | scummvm-rg350-093a31839beca7897032c245ca009da8de7a43d4.tar.gz scummvm-rg350-093a31839beca7897032c245ca009da8de7a43d4.tar.bz2 scummvm-rg350-093a31839beca7897032c245ca009da8de7a43d4.zip |
Insert preliminary Zak256 sound looping support. It's not perfect, as some Zak256 sounds only loop a part of the sample - which our mixer API doesn't yet support.
svn-id: r8741
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/sound.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/scumm/sound.cpp b/scumm/sound.cpp index 516cedbf89..6bac62dd21 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -370,6 +370,8 @@ void Sound::playSound(int soundID) { #endif rate = 11000; int type = *(ptr + 0x0D); + int loop_start = READ_LE_UINT32(ptr+0x26); + int loop_end = READ_LE_UINT32(ptr+0x2A); // Check if it is a CD playback resource if (type == 2) { @@ -399,8 +401,15 @@ void Sound::playSound(int soundID) { sound[x] = bit; } - // FIXME: Maybe something in the header signifies looping? Need to - // track it down and add a mixer flag or something. + if (loop_end > 0) { + flags |= SoundMixer::FLAG_LOOP; + + if ((loop_end < size) || (loop_start > 0)) { + // FIXME: Implement partial loops + warning("Partial loops not implemented. Loop at 0x%X thru 0x%X", loop_start, loop_end); + } + } + _scumm->_mixer->playRaw(NULL, sound, size, 11000, flags, soundID); return; } @@ -724,13 +733,15 @@ void Sound::stopSound(int a) { stopCD(); } - if (_scumm->_imuseDigital) { + if (_scumm->_gameId == GID_ZAK256) { + _scumm->_mixer->stopID(a); + } else if (_scumm->_imuseDigital) { _scumm->_imuseDigital->stopSound(a); } else if (_scumm->_imuse) { _scumm->_imuse->stopSound(a); } else if (_scumm->_playerV2) { _scumm->_playerV2->stopSound (a); - } + } for (i = 0; i < 10; i++) if (_soundQue2[i] == a) |