From 2788cb8bf72f0897a8bed32fbb5730f892b10edf Mon Sep 17 00:00:00 2001 From: Littleboy Date: Wed, 29 Jun 2011 10:26:04 -0400 Subject: LASTEXPRESS: Update sound timer and sound entry playing - Move filtering to SoundEntry class - Make some methods of SoundEntry class private - Add methods to check if a StreamedSound/AppendableSound is done playing --- engines/lastexpress/data/snd.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'engines/lastexpress/data/snd.cpp') diff --git a/engines/lastexpress/data/snd.cpp b/engines/lastexpress/data/snd.cpp index d92ebbc5e3..fa2d8a2e51 100644 --- a/engines/lastexpress/data/snd.cpp +++ b/engines/lastexpress/data/snd.cpp @@ -103,7 +103,8 @@ void SimpleSound::play(Audio::AudioStream *as) { ////////////////////////////////////////////////////////////////////////// // StreamedSound ////////////////////////////////////////////////////////////////////////// -StreamedSound::StreamedSound() {} +StreamedSound::StreamedSound() : _loaded(false) {} + StreamedSound::~StreamedSound() {} bool StreamedSound::load(Common::SeekableReadStream *stream) { @@ -120,9 +121,18 @@ bool StreamedSound::load(Common::SeekableReadStream *stream) { // Start playing the decoded audio stream play(as); + _loaded = true; + return true; } +bool StreamedSound::isFinished() { + if (!_loaded) + return false; + + return !g_system->getMixer()->isSoundHandleActive(_handle); +} + ////////////////////////////////////////////////////////////////////////// // StreamedSound ////////////////////////////////////////////////////////////////////////// @@ -172,4 +182,8 @@ void AppendableSound::finish() { _finished = true; } +bool AppendableSound::isFinished() { + return _as->endOfStream(); +} + } // End of namespace LastExpress -- cgit v1.2.3