aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Howell2006-02-16 08:25:12 +0000
committerTravis Howell2006-02-16 08:25:12 +0000
commit903daa72526b4f702681fcd9e1ed643214aa0692 (patch)
tree2021dc2db89bd0c8b2ce8bda6aed291763fd1e0c
parent448ea4f16e314e9204f21a18e5f9e114478c7e88 (diff)
downloadscummvm-rg350-903daa72526b4f702681fcd9e1ed643214aa0692.tar.gz
scummvm-rg350-903daa72526b4f702681fcd9e1ed643214aa0692.tar.bz2
scummvm-rg350-903daa72526b4f702681fcd9e1ed643214aa0692.zip
Send sound resource data directly to sound mixer in HE Games.\n Fixes songs in kitchen of Pajama Sam 1
svn-id: r20721
-rw-r--r--engines/scumm/he/resource_he.cpp3
-rw-r--r--engines/scumm/he/sound_he.cpp12
2 files changed, 3 insertions, 12 deletions
diff --git a/engines/scumm/he/resource_he.cpp b/engines/scumm/he/resource_he.cpp
index 50d5807f3c..7970068e99 100644
--- a/engines/scumm/he/resource_he.cpp
+++ b/engines/scumm/he/resource_he.cpp
@@ -1806,8 +1806,6 @@ int ScummEngine_v72he::getSoundResourceSize(int id) {
}
void ScummEngine_v80he::createSound(int snd1id, int snd2id) {
- debug(0, "createSound: snd1id %d snd2id %d", snd1id, snd2id);
-
byte *snd1Ptr, *snd2Ptr;
byte *sbng1Ptr, *sbng2Ptr;
byte *sdat1Ptr, *sdat2Ptr;
@@ -1891,7 +1889,6 @@ void ScummEngine_v80he::createSound(int snd1id, int snd2id) {
sdat1size = READ_BE_UINT32(sdat1Ptr + 4) - 8 - _sndPtrOffs;
sdat2size = READ_BE_UINT32(sdat2Ptr + 4) - 8;
- debug(0, "SDAT size1 %d size2 %d", sdat1size, sdat2size);
if (sdat2size < sdat1size) {
src = sdat2Ptr + 8;
dst = sdat1Ptr + 8 + _sndPtrOffs;
diff --git a/engines/scumm/he/sound_he.cpp b/engines/scumm/he/sound_he.cpp
index 36155f8a41..2ab03cec43 100644
--- a/engines/scumm/he/sound_he.cpp
+++ b/engines/scumm/he/sound_he.cpp
@@ -331,7 +331,6 @@ void Sound::processSoundOpcodes(int sound, byte *codePtr, int *soundVars) {
void Sound::playHESound(int soundID, int heOffset, int heChannel, int heFlags) {
byte *ptr, *spoolPtr;
- char *sound;
int size = -1;
int priority, rate;
byte flags = Audio::Mixer::FLAG_UNSIGNED | Audio::Mixer::FLAG_AUTOFREE;
@@ -404,6 +403,7 @@ void Sound::playHESound(int soundID, int heOffset, int heChannel, int heFlags) {
if (READ_UINT32(ptr) == MKID('RIFF') || READ_UINT32(ptr) == MKID('WSOU')) {
uint16 type;
int blockAlign;
+ char *sound;
if (READ_UINT32(ptr) == MKID('WSOU'))
ptr += 8;
@@ -467,11 +467,8 @@ void Sound::playHESound(int soundID, int heOffset, int heChannel, int heFlags) {
_overrideFreq = 0;
}
- // Allocate a sound buffer, copy the data into it, and play
- sound = (char *)malloc(size);
- memcpy(sound, ptr + heOffset + 8, size);
_vm->_mixer->stopHandle(_heSoundChannels[heChannel]);
- _vm->_mixer->playRaw(&_heSoundChannels[heChannel], sound, size, rate, flags, soundID);
+ _vm->_mixer->playRaw(&_heSoundChannels[heChannel], ptr + heOffset + 8, size, rate, flags, soundID);
_vm->setHETimer(heChannel + 4);
_heChannel[heChannel].sound = soundID;
@@ -491,12 +488,9 @@ void Sound::playHESound(int soundID, int heOffset, int heChannel, int heFlags) {
flags = Audio::Mixer::FLAG_AUTOFREE;
- // Allocate a sound buffer, copy the data into it, and play
- sound = (char *)malloc(size);
- memcpy(sound, ptr + 8, size);
_vm->_mixer->stopID(_currentMusic);
_currentMusic = soundID;
- _vm->_mixer->playRaw(NULL, sound, size, rate, flags, soundID);
+ _vm->_mixer->playRaw(NULL, ptr + 8, size, rate, flags, soundID);
}
else if (READ_UINT32(ptr) == MKID('MIDI')) {
if (_vm->_imuse) {