aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/titanic/sound/music_wave.cpp6
-rw-r--r--engines/titanic/sound/wave_file.cpp10
2 files changed, 10 insertions, 6 deletions
diff --git a/engines/titanic/sound/music_wave.cpp b/engines/titanic/sound/music_wave.cpp
index 0f88c32632..8f3f3005ba 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 5d9987a33f..04800b6157 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;