From df5943ae59350b37e6f811ec2e9a968d0660fcab Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Fri, 27 Jul 2012 15:59:58 +0200 Subject: WINTERMUTE: Start sounds again after loading a save. --- engines/wintermute/base/sound/base_sound_buffer.cpp | 15 +++++++++++++-- engines/wintermute/base/sound/base_sound_buffer.h | 1 + 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'engines/wintermute/base') diff --git a/engines/wintermute/base/sound/base_sound_buffer.cpp b/engines/wintermute/base/sound/base_sound_buffer.cpp index aa03609177..25be117db2 100644 --- a/engines/wintermute/base/sound/base_sound_buffer.cpp +++ b/engines/wintermute/base/sound/base_sound_buffer.cpp @@ -63,6 +63,7 @@ BaseSoundBuffer::BaseSoundBuffer(BaseGame *inGame): BaseClass(inGame) { _looping = false; _loopStart = 0; + _startPos = 0; _type = Audio::Mixer::kSFXSoundType; @@ -155,14 +156,21 @@ bool BaseSoundBuffer::play(bool looping, uint32 startSample) { ////////////////////////////////////////////////////////////////////////// void BaseSoundBuffer::setLooping(bool looping) { - warning("BSoundBuffer::SetLooping(%d) - won't change a playing sound", looping); // TODO + if (isPlaying()) { + warning("BSoundBuffer::SetLooping(%d) - won't change a playing sound", looping); // TODO + } _looping = looping; } ////////////////////////////////////////////////////////////////////////// bool BaseSoundBuffer::resume() { + // If the sound was paused while active: if (_stream && _handle) { g_system->getMixer()->pauseHandle(*_handle, false); + } else if (_stream) { // Otherwise we come from a savegame, and thus have no handle + play(_looping, _startPos); + } else { + warning("BaseSoundBuffer::resume - Called without a handle or a stream"); } return STATUS_OK; } @@ -246,7 +254,10 @@ uint32 BaseSoundBuffer::getPosition() { ////////////////////////////////////////////////////////////////////////// bool BaseSoundBuffer::setPosition(uint32 pos) { - warning("BaseSoundBuffer::SetPosition - not implemented yet"); + if (isPlaying()) { + warning("BaseSoundBuffer::SetPosition - not implemented for playing sounds yet."); + } + _startPos = pos; return STATUS_OK; } diff --git a/engines/wintermute/base/sound/base_sound_buffer.h b/engines/wintermute/base/sound/base_sound_buffer.h index c32f83eb1e..107ceb87d7 100644 --- a/engines/wintermute/base/sound/base_sound_buffer.h +++ b/engines/wintermute/base/sound/base_sound_buffer.h @@ -88,6 +88,7 @@ public: int _privateVolume; private: + uint32 _startPos; char *_filename; bool _streamed; Common::SeekableReadStream *_file; -- cgit v1.2.3