diff options
-rw-r--r-- | scumm.dsp | 12 | ||||
-rw-r--r-- | scumm/imuse.cpp | 65 | ||||
-rw-r--r-- | sound/sound.cpp | 51 |
3 files changed, 60 insertions, 68 deletions
@@ -234,10 +234,6 @@ SOURCE=.\scumm\smush\mixer.h # End Source File
# Begin Source File
-SOURCE=.\scumm\smush\palette.cpp
-# End Source File
-# Begin Source File
-
SOURCE=.\scumm\smush\palette.h
# End Source File
# Begin Source File
@@ -250,10 +246,6 @@ SOURCE=.\scumm\smush\player.h # End Source File
# Begin Source File
-SOURCE=.\scumm\smush\rect.cpp
-# End Source File
-# Begin Source File
-
SOURCE=.\scumm\smush\rect.h
# End Source File
# Begin Source File
@@ -407,10 +399,6 @@ SOURCE=.\scumm\smush.h # End Source File
# Begin Source File
-SOURCE=.\scumm\sound.h
-# End Source File
-# Begin Source File
-
SOURCE=.\scumm\string.cpp
# End Source File
# Begin Source File
diff --git a/scumm/imuse.cpp b/scumm/imuse.cpp index d4ca0efc69..21a228e56f 100644 --- a/scumm/imuse.cpp +++ b/scumm/imuse.cpp @@ -39,6 +39,7 @@ #define MDPG_TAG "MDpg" #define MDHD_TAG "MDhd" +#define MAP_TAG "MAP " /* Roland to General Midi patch table. Still needs some work. */ @@ -770,8 +771,7 @@ byte *IMuseInternal::findTag(int sound, char *tag, int index) ptr = _base_sounds[sound]; if (ptr == NULL) { - // debug(1, "IMuseInternal::findTag completely failed finding sound %d", - // sound); + debug(1, "IMuseInternal::findTag completely failed finding sound %d", sound); return NULL; } @@ -829,8 +829,61 @@ bool IMuseInternal::start_sound(int sound) if (!mdhd) { mdhd = findTag(sound, MDPG_TAG, 0); if (!mdhd) { - warning("SE::start_sound failed: Couldn't find %s", MDHD_TAG); - return false; + mdhd = findTag(sound, MAP_TAG, 0); + if (!mdhd) { + warning("SE::start_sound failed: Couldn't find %s", MDHD_TAG); + return false; + } + else { + uint32 size = 0, rate = 0, tag, chan = 0, bits = 0; + uint8 * ptr = g_scumm->getResourceAddress(rtSound, sound); + if (ptr != NULL) { + ptr+=16; + for (;;) { + tag = READ_BE_UINT32(ptr); ptr+=4; + switch(tag) { + case MKID_BE('FRMT'): + size = READ_BE_UINT32(ptr); ptr+=12; + bits = READ_BE_UINT32(ptr); ptr+=4; + rate = READ_BE_UINT32(ptr); ptr+=4; + chan = READ_BE_UINT32(ptr); ptr+=4; + break; + case MKID_BE('TEXT'): + case MKID_BE('REGN'): + case MKID_BE('STOP'): + case MKID_BE('JUMP'): + size = READ_BE_UINT32(ptr); ptr+=size+4; + break; + case MKID_BE('DATA'): + size = READ_BE_UINT32(ptr); ptr+=4; + break; + default: + error("Unknown sfx header %c%c%c%c", tag>>24, tag>>16, tag>>8, tag); + } + if (tag == MKID_BE('DATA')) break; + } + if (bits == 8) { + byte * buffer = (byte*)malloc (size); + memcpy(buffer, ptr, size); + if (chan == 1) { + g_scumm->_mixer->playRaw(NULL, buffer, size, rate, SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_UNSIGNED); + } + else if (chan == 2) { + g_scumm->_mixer->playRaw(NULL, buffer, size, rate, SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_STEREO); + } + } else if (bits == 12) { + byte * buffer = NULL; + uint32 final_size = g_scumm->_sound->decode12BitsSample(ptr, &buffer, size); + if (chan == 1) { + g_scumm->_mixer->playRaw(NULL, buffer, final_size, rate, SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_16BITS); + } + else if (chan == 2) { + g_scumm->_mixer->playRaw(NULL, buffer, final_size, rate, SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_16BITS | SoundMixer::FLAG_STEREO); + } + } + } + return true; + } } } player = allocate_player(128); @@ -1743,8 +1796,8 @@ bool Player::start_sound(int sound) if (mdhd == NULL) { mdhd = _se->findTag(sound, MDPG_TAG, 0); if (mdhd == NULL) { - warning("P::start_sound failed: Couldn't find %s", MDHD_TAG); - return false; + warning("P::start_sound failed: Couldn't find %s", MDHD_TAG); + return false; } } diff --git a/sound/sound.cpp b/sound/sound.cpp index 8015ef9ba6..88f16f442f 100644 --- a/sound/sound.cpp +++ b/sound/sound.cpp @@ -105,56 +105,7 @@ void Sound::processSoundQues() { if ((_scumm->_gameId == GID_DIG) && (data[0] == 4096)){ playBundleMusic(data[1] - 1); } - if ((_scumm->_gameId == GID_DIG) && ((data[0] == 12) || (data[0] == 14))){ - uint32 size = 0, rate = 0, tag, chan = 0, bits = 0; - uint8 * ptr = _scumm->getResourceAddress(rtSound, data[1]); - if (ptr != NULL) { - ptr+=16; /* Skip header */ - for (;;) { - tag = READ_BE_UINT32(ptr); ptr+=4; - switch(tag) { - case MKID_BE('FRMT'): - size = READ_BE_UINT32(ptr); ptr+=12; - bits = READ_BE_UINT32(ptr); ptr+=4; - rate = READ_BE_UINT32(ptr); ptr+=4; - chan = READ_BE_UINT32(ptr); ptr+=4; - break; - case MKID_BE('TEXT'): - case MKID_BE('REGN'): - case MKID_BE('STOP'): - case MKID_BE('JUMP'): - size = READ_BE_UINT32(ptr); ptr+=size+4; - break; - case MKID_BE('DATA'): - size = READ_BE_UINT32(ptr); ptr+=4; - break; - default: - error("Unknown sfx header %c%c%c%c", tag>>24, tag>>16, tag>>8, tag); - } - if (tag == MKID_BE('DATA')) break; - } - if (bits == 8) { - byte * buffer = (byte*)malloc (size); - memcpy(buffer, ptr, size); - if (chan == 1) { - _scumm->_mixer->playRaw(NULL, buffer, size, rate, SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_UNSIGNED); - } - else if (chan == 2) { - _scumm->_mixer->playRaw(NULL, buffer, size, rate, SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_STEREO); - } - } else if (bits == 12) { - byte * buffer = NULL; - uint32 final_size = decode12BitsSample(ptr, &buffer, size); - if (chan == 1) { - _scumm->_mixer->playRaw(NULL, buffer, final_size, rate, SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_16BITS); - } - else if (chan == 2) { - _scumm->_mixer->playRaw(NULL, buffer, final_size, rate, SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_16BITS | SoundMixer::FLAG_STEREO); - } - } - } - } - + if (!(_scumm->_features & GF_AFTER_V7)) { if (se) _scumm->_vars[_scumm->VAR_SOUNDRESULT] = |