aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorJamieson Christian2003-08-14 08:26:59 +0000
committerJamieson Christian2003-08-14 08:26:59 +0000
commit3a39c653affe169958b3ba303e5826fe6cea774a (patch)
treeb6e6ea2ec149cf84c3a21e68693711715dfd0f7d /scumm
parenta0c71ef5e9047dcb2d7b67dabc35b9fc9479b33b (diff)
downloadscummvm-rg350-3a39c653affe169958b3ba303e5826fe6cea774a.tar.gz
scummvm-rg350-3a39c653affe169958b3ba303e5826fe6cea774a.tar.bz2
scummvm-rg350-3a39c653affe169958b3ba303e5826fe6cea774a.zip
Added support for Roland MT-32 music tracks
in monkeyvga/ega. Tested in monkeyvga, but not in monkeyega yet. There are still wrinkles to work out, but the parser for the new format is in and hooked up. svn-id: r9684
Diffstat (limited to 'scumm')
-rw-r--r--scumm/imuse.cpp32
-rw-r--r--scumm/imuse_player.cpp19
-rw-r--r--scumm/resource.cpp23
-rw-r--r--scumm/scummvm.cpp9
4 files changed, 48 insertions, 35 deletions
diff --git a/scumm/imuse.cpp b/scumm/imuse.cpp
index 8bce602b00..1326f5a333 100644
--- a/scumm/imuse.cpp
+++ b/scumm/imuse.cpp
@@ -85,6 +85,10 @@ byte *IMuseInternal::findStartOfSound(int sound) {
return NULL;
}
+ // Check for old-style headers first, like 'RO'
+ if (ptr[4] == 'R' && ptr[5] == 'O')
+ return ptr + 4;
+
ptr += 8;
size = READ_BE_UINT32(ptr);
ptr += 4;
@@ -129,6 +133,10 @@ bool IMuseInternal::isMT32(int sound) {
return false;
}
+ // Check old style headers, like 'RO'
+ if (ptr[4] == 'R' && ptr[5] == 'O')
+ return true;
+
return false;
}
@@ -160,6 +168,10 @@ bool IMuseInternal::isGM(int sound) {
return false;
}
+ // Check old style headers, like 'RO'
+ if (ptr[4] == 'R' && ptr[5] == 'O')
+ return true;
+
return false;
}
@@ -189,7 +201,7 @@ MidiDriver *IMuseInternal::getBestMidiDriver(int sound) {
bool IMuseInternal::startSound(int sound) {
Player *player;
- void *mdhd;
+ void *ptr;
// Do not start a sound if it is already set to
// start on an ImTrigger event. This fixes carnival
@@ -204,24 +216,12 @@ bool IMuseInternal::startSound(int sound) {
return false;
}
- // Not sure exactly what the old code was doing,
- // but we'll go ahead and do a similar check.
- mdhd = findStartOfSound(sound);
- if (!mdhd) {
+ ptr = findStartOfSound(sound);
+ if (!ptr) {
debug(2, "IMuseInternal::startSound(): Couldn't find sound %d!", sound);
return false;
}
-/*
- mdhd = findTag(sound, MDHD_TAG, 0);
- if (!mdhd) {
- mdhd = findTag(sound, MDPG_TAG, 0);
- if (!mdhd) {
- debug(2, "SE::startSound failed: Couldn't find sound %d", sound);
- return false;
- }
- }
-*/
-
+
// Check which MIDI driver this track should use.
// If it's NULL, it ain't something we can play.
MidiDriver *driver = getBestMidiDriver(sound);
diff --git a/scumm/imuse_player.cpp b/scumm/imuse_player.cpp
index 68b4f0931f..2b7bca700e 100644
--- a/scumm/imuse_player.cpp
+++ b/scumm/imuse_player.cpp
@@ -38,6 +38,8 @@
//
////////////////////////////////////////
+extern MidiParser *MidiParser_createRO();
+
static uint read_word(byte *a) {
return (a[0] << 8) + a[1];
}
@@ -84,13 +86,13 @@ Player::~Player() {
}
bool Player::startSound(int sound, MidiDriver *midi) {
- void *mdhd;
+ void *ptr;
int i;
// Not sure what the old code was doing,
// but we'll go ahead and do a similar check.
- mdhd = _se->findStartOfSound(sound);
- if (!mdhd) {
+ ptr = _se->findStartOfSound(sound);
+ if (!ptr) {
warning("Player::startSound(): Couldn't find start of sound %d!", sound);
return false;
}
@@ -177,10 +179,17 @@ int Player::start_seq_sound(int sound, bool reset_vars) {
if (_parser)
delete _parser;
- if (!memcmp(ptr, "FORM", 4))
+ if (!memcmp (ptr, "RO", 2)) {
+ // Old style 'RO' resource
+ _parser = MidiParser_createRO();
+ } else if (!memcmp(ptr, "FORM", 4)) {
+ // Humongous Games XMIDI resource
_parser = MidiParser::createParser_XMIDI();
- else
+ } else {
+ // SCUMM SMF resource
_parser = MidiParser::createParser_SMF();
+ }
+
_parser->setMidiDriver(this);
_parser->property(MidiParser::mpSmartJump, 1);
_parser->loadMusic(ptr, 0);
diff --git a/scumm/resource.cpp b/scumm/resource.cpp
index fdf6b9b6b9..a45f1738c4 100644
--- a/scumm/resource.cpp
+++ b/scumm/resource.cpp
@@ -1451,7 +1451,7 @@ int Scumm::readSoundResourceSmallHeader(int type, int idx) {
(char) (tag & 0xff),
(char) ((tag >> 8) & 0xff), size);
- if (tag == 0x5247) { // RO
+ if (tag == 0x4F52) { // RO
ro_size = size;
ro_offs = _fileHandle.pos();
} else {
@@ -1484,18 +1484,9 @@ int Scumm::readSoundResourceSmallHeader(int type, int idx) {
}
}
- // AD resources have a header, instrument definitions and one MIDI track.
- // We build an 'ADL ' resource from that:
- // 8 bytes resource header
- // 16 bytes MDhd header
- // 14 bytes MThd header
- // 8 bytes MTrk header
- // 7 bytes MIDI tempo sysex
- // + some default instruments
-
if (ro_offs != 0) {
- _fileHandle.seek(ro_offs - 6, SEEK_SET);
- _fileHandle.read(createResource(type, idx, ro_size + 6), ro_size + 6);
+ _fileHandle.seek(ro_offs - 2, SEEK_SET);
+ _fileHandle.read(createResource(type, idx, ro_size + 2), ro_size + 2);
return 1;
} else if (((_midiDriver == MD_PCJR) || (_midiDriver == MD_PCSPK)) && wa_offs != 0) {
if (_features & GF_OLD_BUNDLE) {
@@ -1507,6 +1498,14 @@ int Scumm::readSoundResourceSmallHeader(int type, int idx) {
}
return 1;
} else if (ad_offs != 0) {
+ // AD resources have a header, instrument definitions and one MIDI track.
+ // We build an 'ADL ' resource from that:
+ // 8 bytes resource header
+ // 16 bytes MDhd header
+ // 14 bytes MThd header
+ // 8 bytes MTrk header
+ // 7 bytes MIDI tempo sysex
+ // + some default instruments
byte *ptr;
if (_features & GF_OLD_BUNDLE) {
ptr = (byte *) calloc(ad_size - 4, 1);
diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp
index 2da0b29a70..ef6e3aa684 100644
--- a/scumm/scummvm.cpp
+++ b/scumm/scummvm.cpp
@@ -92,7 +92,7 @@ static const VersionSettings scumm_settings[] = {
GF_SMALL_HEADER | GF_USE_KEY | GF_16COLOR, "000.LFL"},
/* Scumm version 5 */
- {"monkeyVGA", "Monkey Island 1 (256 color Floppy version)", GID_MONKEY_VGA, 4, VersionSettings::ADLIB_ALWAYS,
+ {"monkeyVGA", "Monkey Island 1 (256 color Floppy version)", GID_MONKEY_VGA, 4, VersionSettings::ADLIB_PREFERRED,
GF_SMALL_HEADER | GF_USE_KEY, "000.LFL"},
{"loomcd", "Loom (256 color CD version)", GID_LOOM256, 4, VersionSettings::ADLIB_ALWAYS,
GF_SMALL_HEADER | GF_USE_KEY | GF_AUDIOTRACKS, "000.LFL"},
@@ -1049,7 +1049,12 @@ void Scumm::initScummVars() {
} else {
VAR(VAR_CURRENTDRIVE) = 0;
VAR(VAR_FIXEDDISK) = true;
- VAR(VAR_SOUNDCARD) = (_midiDriver == MD_PCSPK || _midiDriver == MD_PCJR) ? 0 : 3;
+ switch (_midiDriver) {
+ case MD_ADLIB: VAR(VAR_SOUNDCARD) = 3; break;
+ case MD_PCSPK:
+ case MD_PCJR: VAR(VAR_SOUNDCARD) = 0; break;
+ default: VAR(VAR_SOUNDCARD) = 4;
+ }
VAR(VAR_VIDEOMODE) = 0x13;
VAR(VAR_HEAPSPACE) = 1400;
VAR(VAR_MOUSEPRESENT) = true; // FIXME - used to be 0, but that seems odd?!?