aboutsummaryrefslogtreecommitdiff
path: root/engines/lastexpress/data
diff options
context:
space:
mode:
authorLittleboy2011-06-29 10:26:04 -0400
committerLittleboy2011-06-29 11:07:28 -0400
commit2788cb8bf72f0897a8bed32fbb5730f892b10edf (patch)
treead873e2f02064adf23e47c22d29e794c2d9a38b5 /engines/lastexpress/data
parent4526bbb5b63c40a365abf5f150bfbd29cbff32c9 (diff)
downloadscummvm-rg350-2788cb8bf72f0897a8bed32fbb5730f892b10edf.tar.gz
scummvm-rg350-2788cb8bf72f0897a8bed32fbb5730f892b10edf.tar.bz2
scummvm-rg350-2788cb8bf72f0897a8bed32fbb5730f892b10edf.zip
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
Diffstat (limited to 'engines/lastexpress/data')
-rw-r--r--engines/lastexpress/data/snd.cpp16
-rw-r--r--engines/lastexpress/data/snd.h8
2 files changed, 23 insertions, 1 deletions
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
diff --git a/engines/lastexpress/data/snd.h b/engines/lastexpress/data/snd.h
index 95a136ee1c..1c34e4f950 100644
--- a/engines/lastexpress/data/snd.h
+++ b/engines/lastexpress/data/snd.h
@@ -55,6 +55,7 @@ public:
virtual ~SimpleSound();
void stop() const;
+ virtual bool isFinished() = 0;
protected:
void loadHeader(Common::SeekableReadStream *in);
@@ -76,6 +77,11 @@ public:
~StreamedSound();
bool load(Common::SeekableReadStream *stream);
+
+ virtual bool isFinished();
+
+private:
+ bool _loaded;
};
class AppendableSound : public SimpleSound {
@@ -87,6 +93,8 @@ public:
void queueBuffer(Common::SeekableReadStream *bufferIn);
void finish();
+ virtual bool isFinished();
+
private:
Audio::QueuingAudioStream *_as;
bool _finished;