From 9c2fc6721d1719193b465a5bdc8a8308e15832d6 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Thu, 7 Apr 2011 19:39:22 -0400 Subject: GROOVIE: Hook into the new QuickTimeAudioStream code --- engines/groovie/music.cpp | 24 +++++++++++++++++++++--- engines/groovie/music.h | 4 ++++ 2 files changed, 25 insertions(+), 3 deletions(-) (limited to 'engines/groovie') 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 -- cgit v1.2.3