From cf1efc84308ec763ea78d166a14057a95c379cab Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 5 Nov 2016 19:12:39 -0400 Subject: TITANIC: Fix replaying cached previously played sounds --- engines/titanic/sound/sound.cpp | 1 + engines/titanic/sound/wave_file.cpp | 4 ++++ engines/titanic/sound/wave_file.h | 5 +++++ 3 files changed, 10 insertions(+) (limited to 'engines') diff --git a/engines/titanic/sound/sound.cpp b/engines/titanic/sound/sound.cpp index fb8cc299df..c28823148e 100644 --- a/engines/titanic/sound/sound.cpp +++ b/engines/titanic/sound/sound.cpp @@ -129,6 +129,7 @@ CWaveFile *CSound::loadSound(const CString &name) { // Found it, so move it to the front of the list and return _sounds.remove(soundItem); _sounds.push_front(soundItem); + soundItem->_waveFile->reset(); return soundItem->_waveFile; } } diff --git a/engines/titanic/sound/wave_file.cpp b/engines/titanic/sound/wave_file.cpp index 2c583f2160..f2366d1dd5 100644 --- a/engines/titanic/sound/wave_file.cpp +++ b/engines/titanic/sound/wave_file.cpp @@ -106,4 +106,8 @@ uint CWaveFile::getFrequency() const { return _stream->getRate(); } +void CWaveFile::reset() { + _stream->rewind(); +} + } // End of namespace Titanic z diff --git a/engines/titanic/sound/wave_file.h b/engines/titanic/sound/wave_file.h index 19d367936f..e4bb71a0b6 100644 --- a/engines/titanic/sound/wave_file.h +++ b/engines/titanic/sound/wave_file.h @@ -81,6 +81,11 @@ public: * Return the frequency of the loaded wave file */ uint getFrequency() const; + + /** + * Resets the music stream + */ + void reset(); }; } // End of namespace Titanic -- cgit v1.2.3