[Scummvm-git-logs] scummvm master -> b263ca4cf3bd545599306cfcfd1566ce9348bc8c
SupSuper
supsuper at gmail.com
Sat May 22 22:35:31 UTC 2021
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
286ebbdec7 TUCKER: Don't allocate audio files on the stack
b263ca4cf3 MOHAWK: Copy audio streams (fix 12513)
Commit: 286ebbdec7998c25051a06bea37da4e0a34bdb6d
https://github.com/scummvm/scummvm/commit/286ebbdec7998c25051a06bea37da4e0a34bdb6d
Author: SupSuper (supsuper at gmail.com)
Date: 2021-05-22T23:25:56+01:00
Commit Message:
TUCKER: Don't allocate audio files on the stack
Changed paths:
engines/tucker/sequences.cpp
diff --git a/engines/tucker/sequences.cpp b/engines/tucker/sequences.cpp
index 57da9a00e9..eb73c5c95e 100644
--- a/engines/tucker/sequences.cpp
+++ b/engines/tucker/sequences.cpp
@@ -603,14 +603,14 @@ Audio::RewindableAudioStream *AnimationSequencePlayer::loadSound(int index, Anim
return stream;
Common::String fileName = Common::String::format("audio/%s", _audioFileNamesTable[index]);
- Common::File f;
- if (f.open(fileName)) {
+ Common::File *f = new Common::File();
+ if (f->open(fileName)) {
int size = 0, rate = 0;
uint8 flags = 0;
switch (type) {
case kAnimationSoundType8BitsRAW:
case kAnimationSoundType16BitsRAW:
- size = f.size();
+ size = f->size();
rate = 22050;
flags = Audio::FLAG_UNSIGNED;
if (type == kAnimationSoundType16BitsRAW)
@@ -619,18 +619,21 @@ Audio::RewindableAudioStream *AnimationSequencePlayer::loadSound(int index, Anim
if (size != 0) {
uint8 *sampleData = (uint8 *)malloc(size);
if (sampleData) {
- f.read(sampleData, size);
+ f->read(sampleData, size);
stream = Audio::makeRawStream(sampleData, size, rate, flags);
}
}
+ delete f;
break;
case kAnimationSoundTypeWAV:
- stream = Audio::makeWAVStream(&f, DisposeAfterUse::NO);
+ stream = Audio::makeWAVStream(f, DisposeAfterUse::YES);
break;
default:
+ delete f;
break;
}
-
+ } else {
+ delete f;
}
return stream;
}
Commit: b263ca4cf3bd545599306cfcfd1566ce9348bc8c
https://github.com/scummvm/scummvm/commit/b263ca4cf3bd545599306cfcfd1566ce9348bc8c
Author: SupSuper (supsuper at gmail.com)
Date: 2021-05-22T23:33:36+01:00
Commit Message:
MOHAWK: Copy audio streams (fix 12513)
Changed paths:
engines/mohawk/myst_sound.cpp
diff --git a/engines/mohawk/myst_sound.cpp b/engines/mohawk/myst_sound.cpp
index fc5d1b3489..aadf7ccfdb 100644
--- a/engines/mohawk/myst_sound.cpp
+++ b/engines/mohawk/myst_sound.cpp
@@ -46,10 +46,12 @@ MystSound::~MystSound() {
}
Audio::RewindableAudioStream *MystSound::makeAudioStream(uint16 id, CueList *cueList) {
- if (_vm->isGameVariant(GF_ME))
- return Audio::makeWAVStream(_vm->getResource(ID_MSND, convertMystID(id)), DisposeAfterUse::YES);
- else
+ if (_vm->isGameVariant(GF_ME)) {
+ Common::SeekableReadStream *stream = _vm->getResource(ID_MSND, convertMystID(id));
+ return Audio::makeWAVStream(stream->readStream(stream->size()), DisposeAfterUse::YES);
+ } else {
return makeMohawkWaveStream(_vm->getResource(ID_MSND, id), cueList);
+ }
}
void MystSound::playEffect(uint16 id, bool loop) {
More information about the Scummvm-git-logs
mailing list