aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/sfx
diff options
context:
space:
mode:
authorFilippos Karapetis2009-07-11 06:53:39 +0000
committerFilippos Karapetis2009-07-11 06:53:39 +0000
commit2b5fac58d5323847042e53f114ad94ce2d526f3b (patch)
tree6b05334adf66855435ee1b8ed200a6decb184650 /engines/sci/sfx
parent28dd343e08afb9eeb8318d06c8c18eb6b48fd210 (diff)
downloadscummvm-rg350-2b5fac58d5323847042e53f114ad94ce2d526f3b.tar.gz
scummvm-rg350-2b5fac58d5323847042e53f114ad94ce2d526f3b.tar.bz2
scummvm-rg350-2b5fac58d5323847042e53f114ad94ce2d526f3b.zip
Applied patch 2818733 - "SCI: Timer iterator for audio resources played via doSound"
svn-id: r42375
Diffstat (limited to 'engines/sci/sfx')
-rw-r--r--engines/sci/sfx/iterator.cpp35
-rw-r--r--engines/sci/sfx/iterator.h6
-rw-r--r--engines/sci/sfx/iterator_internal.h22
3 files changed, 63 insertions, 0 deletions
diff --git a/engines/sci/sfx/iterator.cpp b/engines/sci/sfx/iterator.cpp
index ebba4bceac..6c5706a8c1 100644
--- a/engines/sci/sfx/iterator.cpp
+++ b/engines/sci/sfx/iterator.cpp
@@ -1164,6 +1164,41 @@ int CleanupSongIterator::nextCommand(byte *buf, int *result) {
return SI_FINISHED;
}
+/**********************/
+/*-- Timer iterator --*/
+/**********************/
+TimerSongIterator::TimerSongIterator(int delta)
+ : _delta(delta) {
+}
+
+int TimerSongIterator::nextCommand(byte *buf, int *result) {
+ if (_delta) {
+ return _delta;
+ }
+ return SI_FINISHED;
+}
+
+SongIterator *TimerSongIterator::handleMessage(Message msg) {
+ return NULL;
+}
+
+int TimerSongIterator::getTimepos() {
+ return 0;
+}
+
+Audio::AudioStream *TimerSongIterator::getAudioStream() {
+ return NULL;
+}
+
+SongIterator *TimerSongIterator::clone(int delta) {
+ TimerSongIterator *newit = new TimerSongIterator(*this);
+ return newit;
+}
+
+SongIterator *new_timer_iterator(int delta) {
+ return new TimerSongIterator(delta);
+}
+
/**********************************/
/*-- Fast-forward song iterator --*/
/**********************************/
diff --git a/engines/sci/sfx/iterator.h b/engines/sci/sfx/iterator.h
index 547c479bbf..4e6df367c9 100644
--- a/engines/sci/sfx/iterator.h
+++ b/engines/sci/sfx/iterator.h
@@ -281,6 +281,12 @@ int songit_next(SongIterator **it, byte *buf, int *result, int mask);
*/
SongIterator *songit_new(byte *data, uint size, SongIteratorType type, songit_id_t id);
+/* Constructs a new song timer iterator object
+** Parameters: (int) delta: The delta after which to fire SI_FINISHED
+** Returns : (SongIterator *) A newly allocated but uninitialized song
+** iterator
+*/
+SongIterator *new_timer_iterator(int delta);
/* Handles a message to the song iterator
** Parameters: (SongIterator **): A reference to the variable storing the song iterator
diff --git a/engines/sci/sfx/iterator_internal.h b/engines/sci/sfx/iterator_internal.h
index 7d5a17fd25..00044b8ab7 100644
--- a/engines/sci/sfx/iterator_internal.h
+++ b/engines/sci/sfx/iterator_internal.h
@@ -181,6 +181,28 @@ private:
#define PLAYMASK_NONE 0x0
+/***************************/
+/*--------- Timer ---------*/
+/***************************/
+
+/**
+ * A song iterator which waits a specified time and then fires
+ * SI_FINISHED. Used by DoSound, where audio resources are played (SCI1)
+ */
+class TimerSongIterator : public SongIterator {
+protected:
+ int _delta; /**!< Remaining time */
+
+public:
+ TimerSongIterator(int delta);
+
+ int nextCommand(byte *buf, int *result);
+ Audio::AudioStream *getAudioStream();
+ SongIterator *handleMessage(Message msg);
+ int getTimepos();
+ SongIterator *clone(int delta);
+};
+
/**********************************/
/*--------- Fast Forward ---------*/
/**********************************/