[Scummvm-cvs-logs] CVS: scummvm/scumm sound.cpp,1.341,1.342
Travis Howell
kirben at users.sourceforge.net
Mon Jul 12 06:23:02 CEST 2004
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14810/scumm
Modified Files:
sound.cpp
Log Message:
Add HE 7.1 games music support, untested.
Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.341
retrieving revision 1.342
diff -u -d -r1.341 -r1.342
--- sound.cpp 12 Jul 2004 09:02:18 -0000 1.341
+++ sound.cpp 12 Jul 2004 13:22:48 -0000 1.342
@@ -158,17 +158,17 @@
debugC(DEBUG_SOUND, "playSound #%d (room %d)", soundID,
_vm->getResourceRoomNr(rtSound, soundID));
- if ((_vm->_heversion == 70 || _vm->_heversion == 71) && soundID >= 4000) {
+ if ((_vm->_heversion >= 70) && soundID >= 4000) {
int music_offs, total_size;
char buf[32];
File musicFile;
sprintf(buf, "%s.he4", _vm->getGameName());
if (musicFile.open(buf) == false) {
+ warning("playSound: Music file is not open");
return;
}
musicFile.seek(4, SEEK_SET);
total_size = musicFile.readUint32BE();
- debug(1, "Total Music file size %d", total_size);
// Skip header junk
musicFile.seek(+20, SEEK_CUR);
@@ -183,25 +183,23 @@
music_offs = musicFile.readUint32LE();
size = musicFile.readUint32LE();
- musicFile.seek(music_offs, SEEK_SET);
-
-
if (music_offs > total_size || (size + music_offs) > total_size)
error("Bad music offsets");
- byte *src_ptr = (byte *) calloc(size, 1);
- musicFile.read(src_ptr, size);
+ musicFile.seek(music_offs, SEEK_SET);
+ ptr = (byte *) calloc(size, 1);
+ musicFile.read(ptr, size);
musicFile.close();
- rate = 11025;
-
- // Allocate a sound buffer, copy the data into it, and play
- sound = (char *)malloc(size);
- memcpy(sound, src_ptr, size);
- _currentMusic = soundID;
- _vm->_mixer->stopHandle(_musicChannelHandle);
- _vm->_mixer->playRaw(&_musicChannelHandle, sound, size, rate, flags, soundID);
- return;
+ if (_vm->_heversion == 70) {
+ // Allocate a sound buffer, copy the data into it, and play
+ sound = (char *)malloc(size);
+ memcpy(sound, ptr, size);
+ _currentMusic = soundID;
+ _vm->_mixer->stopHandle(_musicChannelHandle);
+ _vm->_mixer->playRaw(&_musicChannelHandle, sound, size, 11025, flags, soundID);
+ return;
+ }
}
ptr = _vm->getResourceAddress(rtSound, soundID);
More information about the Scummvm-git-logs
mailing list