diff options
author | Max Horn | 2003-12-13 20:01:35 +0000 |
---|---|---|
committer | Max Horn | 2003-12-13 20:01:35 +0000 |
commit | 35c481fd61439864892b2b6c72fffe5af6592720 (patch) | |
tree | 641b82298c9f35b5255f14ee05adca3db9d30231 /scumm/sound.cpp | |
parent | 5ff7c1d1532663eb8a00bbf60c39ba560a50a67f (diff) | |
download | scummvm-rg350-35c481fd61439864892b2b6c72fffe5af6592720.tar.gz scummvm-rg350-35c481fd61439864892b2b6c72fffe5af6592720.tar.bz2 scummvm-rg350-35c481fd61439864892b2b6c72fffe5af6592720.zip |
* don't call a variable 'bit' which stores a byte'
* fix off-by-one loop length
* loopStart seems to be specified in samples, not bytes, fixing that (but I don't know of any place where I could test it...)
* Indy3Towns uses sound type 255, not 1, for Euphony music, it seems empirically
* print a warning if we encounter an unknown/unsupported sound sub-type
svn-id: r11618
Diffstat (limited to 'scumm/sound.cpp')
-rw-r--r-- | scumm/sound.cpp | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/scumm/sound.cpp b/scumm/sound.cpp index 7d8da3e65a..795b897e1e 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -283,22 +283,24 @@ void Sound::playSound(int soundID) { _scumm->_mixer->playRaw(NULL, sound, size, rate, flags, soundID); } else if ((_scumm->_features & GF_FMTOWNS) || READ_UINT32(ptr) == MKID('SOUN') || READ_UINT32(ptr) == MKID('TOWS')) { + bool tows = READ_UINT32(ptr) == MKID('TOWS'); - if (_scumm->_features & GF_FMTOWNS) + if (_scumm->_features & GF_FMTOWNS) { size = READ_LE_UINT32(ptr); - else - { + } else { size = READ_BE_UINT32(ptr + 4) - 2; if (tows) size += 8; ptr += 2; } + rate = 11025; int type = *(ptr + 0x0D); int numInstruments; if (tows) type = 0; + switch (type) { case 0: // Sound effect numInstruments = *(ptr + 0x14); @@ -306,12 +308,12 @@ void Sound::playSound(int soundID) { numInstruments = 1; ptr += 0x16; size -= 0x16; + while (numInstruments--) { int waveSize = READ_LE_UINT32(ptr + 0x0C); - int loopStart = READ_LE_UINT32(ptr + 0x10); - int loopEnd = READ_LE_UINT32(ptr + 0x14); + int loopStart = READ_LE_UINT32(ptr + 0x10) * 2; + int loopEnd = READ_LE_UINT32(ptr + 0x14) - 1; rate = READ_LE_UINT32(ptr + 0x18) * 1000 / 0x62; - ptr += 0x20; size -= 0x20; if (size < waveSize) { @@ -320,11 +322,11 @@ void Sound::playSound(int soundID) { } sound = (char *)malloc(waveSize); for (int x = 0; x < waveSize; x++) { - int bit = *ptr++; - if (bit < 0x80) - sound[x] = 0x7F - bit; + int b = *ptr++; + if (b < 0x80) + sound[x] = 0x7F - b; else - sound[x] = bit; + sound[x] = b; } size -= waveSize; @@ -335,6 +337,7 @@ void Sound::playSound(int soundID) { } break; case 1: + case 255: // 255 is the type used in Indy3 FMTowns // Music (Euphony format) if (_scumm->_musicEngine) _scumm->_musicEngine->startSound(soundID); @@ -357,6 +360,9 @@ void Sound::playSound(int soundID) { _currentCDSound = soundID; break; + default: // Unsupported sound type + warning("Unsupported sound sub-type %d", type); + break; } } else if ((_scumm->_gameId == GID_LOOM) && (_scumm->_features & GF_MACINTOSH)) { |