[Scummvm-git-logs] scummvm master -> e942131e22e412a6044c8bf1419c13ece7acd215
dreammaster
dreammaster at scummvm.org
Fri Feb 10 04:37:59 CET 2017
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
e942131e22 TITANIC: Extra sanity checks before locking CWaveFiles for access
Commit: e942131e22e412a6044c8bf1419c13ece7acd215
https://github.com/scummvm/scummvm/commit/e942131e22e412a6044c8bf1419c13ece7acd215
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-02-09T22:37:51-05:00
Commit Message:
TITANIC: Extra sanity checks before locking CWaveFiles for access
Changed paths:
engines/titanic/sound/wave_file.cpp
engines/titanic/sound/wave_file.h
diff --git a/engines/titanic/sound/wave_file.cpp b/engines/titanic/sound/wave_file.cpp
index 0d9d86d..e49c44d 100644
--- a/engines/titanic/sound/wave_file.cpp
+++ b/engines/titanic/sound/wave_file.cpp
@@ -20,6 +20,7 @@
*
*/
+#include "audio/decoders/raw.h"
#include "audio/decoders/wave.h"
#include "common/memstream.h"
#include "titanic/sound/wave_file.h"
@@ -30,13 +31,13 @@ namespace Titanic {
CWaveFile::CWaveFile() : _soundManager(nullptr), _audioStream(nullptr),
_waveData(nullptr), _waveSize(0), _dataSize(0), _headerSize(0),
- _soundType(Audio::Mixer::kPlainSoundType) {
+ _rate(0), _flags(0), _soundType(Audio::Mixer::kPlainSoundType) {
setup();
}
CWaveFile::CWaveFile(QSoundManager *owner) : _soundManager(owner), _audioStream(nullptr),
_waveData(nullptr), _waveSize(0), _dataSize(0), _headerSize(0),
- _soundType(Audio::Mixer::kPlainSoundType) {
+ _rate(0), _flags(0), _soundType(Audio::Mixer::kPlainSoundType) {
setup();
}
@@ -137,9 +138,7 @@ void CWaveFile::load(byte *data, uint size) {
// Parse the wave header
Common::MemoryReadStream wavStream(data, size, DisposeAfterUse::NO);
- int rate;
- byte flags;
- Audio::loadWAVFromStream(wavStream, _dataSize, rate, flags);
+ Audio::loadWAVFromStream(wavStream, _dataSize, _rate, _flags);
_headerSize = wavStream.pos();
}
@@ -168,7 +167,8 @@ void CWaveFile::reset() {
const uint16 *CWaveFile::lock() {
switch (_loadMode) {
case LOADMODE_SCUMMVM:
- assert(_waveData);
+ assert(_waveData && _rate == 22050);
+ assert(_flags == (Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_16BITS));
return (uint16 *)(_waveData + _headerSize);
default:
diff --git a/engines/titanic/sound/wave_file.h b/engines/titanic/sound/wave_file.h
index 5a467c8..b530320 100644
--- a/engines/titanic/sound/wave_file.h
+++ b/engines/titanic/sound/wave_file.h
@@ -41,6 +41,8 @@ private:
int _waveSize;
int _dataSize;
int _headerSize;
+ int _rate;
+ byte _flags;
QSoundManager *_soundManager;
Audio::SeekableAudioStream *_audioStream;
Audio::SoundHandle _soundHandle;
More information about the Scummvm-git-logs
mailing list