[Scummvm-git-logs] scummvm master -> c2b3abd676a194138849252a3e37d6cb977a343c
dreammaster
dreammaster at scummvm.org
Fri Feb 10 01:54:21 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:
c2b3abd676 TITANIC: Fix calculation of wave file size
Commit: c2b3abd676a194138849252a3e37d6cb977a343c
https://github.com/scummvm/scummvm/commit/c2b3abd676a194138849252a3e37d6cb977a343c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-02-09T19:54:13-05:00
Commit Message:
TITANIC: Fix calculation of wave file size
Changed paths:
engines/titanic/sound/music_wave.cpp
engines/titanic/sound/wave_file.cpp
diff --git a/engines/titanic/sound/music_wave.cpp b/engines/titanic/sound/music_wave.cpp
index 0f88c32..8f3f300 100644
--- a/engines/titanic/sound/music_wave.cpp
+++ b/engines/titanic/sound/music_wave.cpp
@@ -313,13 +313,15 @@ void CMusicWave::chooseWaveFile(int index, int size) {
}
}
- int arrIndex = _arrayIndex - _items[waveIndex]._value + index;
+ const CMusicWaveFile &wf = _items[waveIndex];
+ int arrIndex = _arrayIndex - wf._value + index;
+ uint waveSize = wf._waveFile->size();
_waveIndex = waveIndex;
_readPos = 0;
_readIncrement = (int)(_array[arrIndex] * 256);
_size = size;
- _count = _items[waveIndex]._waveFile->size() / 2;
+ _count = waveSize / 2;
}
void CMusicWave::setupArray(int minVal, int maxVal) {
diff --git a/engines/titanic/sound/wave_file.cpp b/engines/titanic/sound/wave_file.cpp
index 5d9987a..04800b6 100644
--- a/engines/titanic/sound/wave_file.cpp
+++ b/engines/titanic/sound/wave_file.cpp
@@ -81,12 +81,14 @@ bool CWaveFile::loadSound(const CString &name) {
return false;
Common::SeekableReadStream *stream = file.readStream();
- _dataSize = stream->size();
- _rawData = new byte[_dataSize];
- stream->read(_rawData, _dataSize);
+ uint dataSize = stream->size();
+ _dataSize = dataSize - 44;
+
+ _rawData = new byte[dataSize];
+ stream->read(_rawData, dataSize);
_audioStream = Audio::makeWAVStream(
- new Common::MemoryReadStream(_rawData, _dataSize, DisposeAfterUse::YES),
+ new Common::MemoryReadStream(_rawData, dataSize, DisposeAfterUse::YES),
DisposeAfterUse::YES);
_soundType = Audio::Mixer::kSFXSoundType;
More information about the Scummvm-git-logs
mailing list