aboutsummaryrefslogtreecommitdiff
path: root/scumm/sound.cpp
diff options
context:
space:
mode:
authorTravis Howell2004-08-22 15:02:53 +0000
committerTravis Howell2004-08-22 15:02:53 +0000
commit4f51ae998842324c268a08a6b88ca9e6f8b84c4e (patch)
tree22bd50e04bb1663927a58fd68131b284898bd2f9 /scumm/sound.cpp
parente00f9f4a97dc2bcd1b8007a043396e49d0583b0d (diff)
downloadscummvm-rg350-4f51ae998842324c268a08a6b88ca9e6f8b84c4e.tar.gz
scummvm-rg350-4f51ae998842324c268a08a6b88ca9e6f8b84c4e.tar.bz2
scummvm-rg350-4f51ae998842324c268a08a6b88ca9e6f8b84c4e.zip
Basic start on freddemo (old version)
svn-id: r14685
Diffstat (limited to 'scumm/sound.cpp')
-rw-r--r--scumm/sound.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/scumm/sound.cpp b/scumm/sound.cpp
index 1770287002..d32301bd8e 100644
--- a/scumm/sound.cpp
+++ b/scumm/sound.cpp
@@ -160,6 +160,7 @@ void Sound::playSound(int soundID, int offset) {
int size = -1;
int rate;
byte flags = SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE;
+ bool music = false;
debugC(DEBUG_SOUND, "playSound #%d (room %d)", soundID,
_vm->getResourceRoomNr(rtSound, soundID));
@@ -189,20 +190,24 @@ void Sound::playSound(int soundID, int offset) {
music_offs = musicFile.readUint32LE();
size = musicFile.readUint32LE();
- if (music_offs > total_size || (size + music_offs) > total_size)
- error("Bad music offsets");
+ if (music_offs > total_size || (size + music_offs) > total_size) {
+ warning("Bad music offsets");
+ musicFile.close();
+ return;
+ }
musicFile.seek(music_offs, SEEK_SET);
ptr = (byte *) calloc(size, 1);
musicFile.read(ptr, size);
musicFile.close();
+ _currentMusic = soundID;
+ music = true;
if (_vm->_heversion == 70) {
// Allocate a sound buffer, copy the data into it, and play
sound = (char *)malloc(size);
memcpy(sound, ptr, size);
free(ptr);
- _currentMusic = soundID;
_vm->_mixer->stopHandle(_musicChannelHandle);
_vm->_mixer->playRaw(&_musicChannelHandle, sound, size, 11025, flags, soundID);
return;
@@ -251,7 +256,12 @@ void Sound::playSound(int soundID, int offset) {
// Allocate a sound buffer, copy the data into it, and play
sound = (char *)malloc(size);
memcpy(sound, ptr + offset + 8, size);
- _vm->_mixer->playRaw(NULL, sound, size, rate, flags, soundID);
+
+ if (music == true) {
+ _vm->_mixer->stopHandle(_musicChannelHandle);
+ _vm->_mixer->playRaw(&_musicChannelHandle, sound, size, rate, flags, soundID);
+ } else
+ _vm->_mixer->playRaw(NULL, sound, size, rate, flags, soundID);
}
else if (READ_UINT32(ptr) == MKID('MRAW')) {
// pcm music in 3DO humongous games