diff options
author | Jamieson Christian | 2003-05-19 05:04:38 +0000 |
---|---|---|
committer | Jamieson Christian | 2003-05-19 05:04:38 +0000 |
commit | 417dc08484c6ecfc0b3aa64a18decfc85f2b95d4 (patch) | |
tree | f177dc64c2151718a25c7bf03e48843e0c973deb | |
parent | ff418964800f14c6041b072c8d510005929c19f2 (diff) | |
download | scummvm-rg350-417dc08484c6ecfc0b3aa64a18decfc85f2b95d4.tar.gz scummvm-rg350-417dc08484c6ecfc0b3aa64a18decfc85f2b95d4.tar.bz2 scummvm-rg350-417dc08484c6ecfc0b3aa64a18decfc85f2b95d4.zip |
Proof of concept for XMIDI parser in Humongous games.
You must still uncomment the VAR_SOUNDPARAM setting for this to work...?
svn-id: r7670
-rw-r--r-- | scumm/imuse.cpp | 21 | ||||
-rw-r--r-- | scumm/imuse.h | 1 | ||||
-rw-r--r-- | scumm/sound.cpp | 23 |
3 files changed, 45 insertions, 0 deletions
diff --git a/scumm/imuse.cpp b/scumm/imuse.cpp index 2662b6c039..4be77f7669 100644 --- a/scumm/imuse.cpp +++ b/scumm/imuse.cpp @@ -408,6 +408,7 @@ public: void setBase(byte **base); uint32 property(int prop, uint32 value); + MidiDriver *getMidiDriver(); static IMuseInternal *create(OSystem *syst, MidiDriver *midi); }; @@ -526,6 +527,25 @@ IMuseInternal::~IMuseInternal() { terminate(); } +MidiDriver *IMuseInternal::getMidiDriver() { + MidiDriver *driver = NULL; + + if (_midi_native) { + driver = _midi_native; +#if !defined(__PALM_OS__) // Adlib not supported on PalmOS + } else { + // Route it through Adlib anyway. + if (!_midi_adlib) { + _midi_adlib = MidiDriver_ADLIB_create(); + initMidiDriver (_midi_adlib); + } + driver = _midi_adlib; +#endif + } + + return driver; +} + byte *IMuseInternal::findTag(int sound, char *tag, int index) { byte *ptr = NULL; int32 size, pos; @@ -3488,6 +3508,7 @@ int32 IMuse::doCommand(int a, int b, int c, int d, int e, int f, int g, int h) { int IMuse::clear_queue() { in(); int ret = _target->clear_queue(); out(); return ret; } void IMuse::setBase(byte **base) { in(); _target->setBase (base); out(); } uint32 IMuse::property(int prop, uint32 value) { in(); uint32 ret = _target->property (prop, value); out(); return ret; } +MidiDriver *IMuse::getMidiDriver() { in(); MidiDriver *ret = _target->getMidiDriver(); out(); return ret; } // The IMuse::create method provides a front-end factory // for creating IMuseInternal without exposing that class diff --git a/scumm/imuse.h b/scumm/imuse.h index b14a877e1f..bb5c85a3ea 100644 --- a/scumm/imuse.h +++ b/scumm/imuse.h @@ -66,6 +66,7 @@ public: int clear_queue(); void setBase(byte **base); uint32 property(int prop, uint32 value); + MidiDriver *getMidiDriver(); // Factory methods static IMuse *create(OSystem *syst, MidiDriver *midi); diff --git a/scumm/sound.cpp b/scumm/sound.cpp index 60e549bbe8..3f2ea63ed1 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -31,6 +31,8 @@ #include "common/config-file.h" #include "common/util.h" +#include "sound/midiparser.h" + Sound::Sound(Scumm *parent) { memset(this,0,sizeof(Sound)); // palmos @@ -174,6 +176,8 @@ void Sound::playSound(int soundID) { int rate; byte flags = SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE; +debug (0, "playSound (%d)", soundID); + debug(3,"playSound #%d (room %d)", soundID, _scumm->getResourceRoomNr(rtSound, soundID)); ptr = _scumm->getResourceAddress(rtSound, soundID); if (ptr) { @@ -244,6 +248,25 @@ void Sound::playSound(int soundID) { // XMI playing stuff goes here // ptr should be pointing to XMI file in memory + // HACK (Jamieson630): Just to see if it works. + static MidiParser *parser = 0; + + MidiDriver *driver = 0; + if (_scumm && _scumm->_imuse) + driver = _scumm->_imuse->getMidiDriver(); + if (driver) { + driver->setTimerCallback (0, 0); + if (parser) { + delete parser; + parser = 0; + } + parser = MidiParser::createParser_XMIDI(); + parser->setMidiDriver (driver); + parser->setTimerRate (driver->getBaseTempo()); + parser->loadMusic (ptr, size); + driver->open(); + driver->setTimerCallback (parser, &MidiParser::timerCallback); + } // FIXME: dumping xmi files for testing, remove when working if (1) { |