aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sound.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/sound.cpp b/sound.cpp
index a29da2d396..ab6336b5cc 100644
--- a/sound.cpp
+++ b/sound.cpp
@@ -681,7 +681,6 @@ void Scumm::decompressBundleSound(int index) {
int i, z;
COMP_table table[50];
static unsigned char *CompInput, *CompOutput, *CompFinal;
- static bool initted;
int outputSize, finalSize;
fileSeek(_sfxFile, bundle_table[index].offset, SEEK_SET);
@@ -703,10 +702,7 @@ void Scumm::decompressBundleSound(int index) {
fileReadDwordBE(_sfxFile);
}
- if (!initted) {
- CompFinal = (unsigned char *)alloc(1000000);
- initted = true;
- }
+ CompFinal = (unsigned char *)malloc(1000000);
finalSize = 0;
@@ -749,7 +745,7 @@ void Scumm::decompressBundleSound(int index) {
default:
printf("Unknown codec %d!\n", table[i].codec);
break;
- }
+ }
memcpy(&CompFinal[finalSize], &CompOutput[0], outputSize);
finalSize+=outputSize;
@@ -759,9 +755,9 @@ void Scumm::decompressBundleSound(int index) {
}
/* FIXME: This is nasty. We are actually sending the whole
- decompressed packet to the mixer.. but the packet
- actually contains further subblocks! (eg, sync) */
- _mixer->play_raw(NULL, CompFinal, finalSize,22050, SoundMixer::FLAG_UNSIGNED);
+ decompressed packet to the mixer.. but the packet
+ actually contains further subblocks! (eg, sync) */
+ _mixer->play_raw(NULL, CompFinal, finalSize, 22050, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE);
}
void Scumm::playBundleSound(char *sound)