aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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