aboutsummaryrefslogtreecommitdiff
path: root/engines/groovie
diff options
context:
space:
mode:
authorMatthew Hoops2011-04-07 19:39:22 -0400
committerMatthew Hoops2011-04-07 19:40:07 -0400
commit9c2fc6721d1719193b465a5bdc8a8308e15832d6 (patch)
tree13e888a654b3ba176c2865c997c128f60ec0e416 /engines/groovie
parent8cf73e3fb4e44567a7afa527a0705acb90033a78 (diff)
downloadscummvm-rg350-9c2fc6721d1719193b465a5bdc8a8308e15832d6.tar.gz
scummvm-rg350-9c2fc6721d1719193b465a5bdc8a8308e15832d6.tar.bz2
scummvm-rg350-9c2fc6721d1719193b465a5bdc8a8308e15832d6.zip
GROOVIE: Hook into the new QuickTimeAudioStream code
Diffstat (limited to 'engines/groovie')
-rw-r--r--engines/groovie/music.cpp24
-rw-r--r--engines/groovie/music.h4
2 files changed, 25 insertions, 3 deletions
diff --git a/engines/groovie/music.cpp b/engines/groovie/music.cpp
index bdb080d204..0d0d8770b3 100644
--- a/engines/groovie/music.cpp
+++ b/engines/groovie/music.cpp
@@ -31,7 +31,9 @@
#include "common/config-manager.h"
#include "common/macresman.h"
#include "common/memstream.h"
+#include "audio/audiostream.h"
#include "audio/midiparser.h"
+#include "audio/decoders/quicktime.h"
namespace Groovie {
@@ -755,10 +757,26 @@ void MusicPlayerMPEG4::updateVolume() {
}
bool MusicPlayerMPEG4::load(uint32 fileref, bool loop) {
- // TODO
+ // Stop any old sound
+ _vm->_system->getMixer()->stopHandle(_handle);
+
+ // Create the audio stream
Common::String filename = Common::String::format("gu%d.m4a", fileref & 0x3FF);
- warning("TODO: Play MPEG-4 sound '%s'", filename.c_str());
- return false;
+ Audio::AudioStream *audStream = Audio::makeQuickTimeStream(filename);
+
+ if (!audStream) {
+ // MPEG-4 sounds aren't handled yet, so nothing should play here yet
+ warning("Could not play MPEG-4 sound '%s'", filename.c_str());
+ return false;
+ }
+
+ // Loop if requested
+ if (loop)
+ audStream = Audio::makeLoopingAudioStream((Audio::RewindableAudioStream *)audStream, 0);
+
+ // Play!
+ _vm->_system->getMixer()->playStream(Audio::Mixer::kMusicSoundType, &_handle, audStream);
+ return true;
}
} // End of Groovie namespace
diff --git a/engines/groovie/music.h b/engines/groovie/music.h
index 9855c898fe..8f8aabb0db 100644
--- a/engines/groovie/music.h
+++ b/engines/groovie/music.h
@@ -29,6 +29,7 @@
#include "common/array.h"
#include "common/mutex.h"
#include "audio/mididrv.h"
+#include "audio/mixer.h"
class MidiParser;
@@ -167,6 +168,9 @@ public:
protected:
void updateVolume();
bool load(uint32 fileref, bool loop);
+
+private:
+ Audio::SoundHandle _handle;
};
} // End of Groovie namespace