From 672bdeff1f4a0e73d4565ab596af4833e9b7075a Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sat, 4 Jul 2015 23:34:08 +0200 Subject: MADE: Allow loading of sample.ad from rtzcd.red At the moment, AdLib music doesn't work yet though. At least not for this particular case. --- engines/made/made.cpp | 2 +- engines/made/music.cpp | 25 ++++++++++++++++++------- engines/made/music.h | 2 +- 3 files changed, 20 insertions(+), 9 deletions(-) (limited to 'engines') diff --git a/engines/made/made.cpp b/engines/made/made.cpp index ab07ef757b..5d3e6d7069 100644 --- a/engines/made/made.cpp +++ b/engines/made/made.cpp @@ -275,7 +275,7 @@ void MadeEngine::handleEvents() { } Common::Error MadeEngine::run() { - _music = new MusicPlayer(getGameID() == GID_RTZ); + _music = new MusicPlayer(getGameID() == GID_RTZ, (getFeatures() & GF_CD_COMPRESSED) != 0); syncSoundSettings(); // Initialize backend diff --git a/engines/made/music.cpp b/engines/made/music.cpp index 6e5acb88b0..7efa24f985 100644 --- a/engines/made/music.cpp +++ b/engines/made/music.cpp @@ -25,21 +25,30 @@ // MIDI and digital music class #include "made/music.h" +#include "made/redreader.h" #include "made/resource.h" #include "audio/midiparser.h" #include "audio/miles.h" +#include "common/stream.h" + namespace Made { -MusicPlayer::MusicPlayer(bool milesAudio) : _isGM(false),_milesAudioMode(false) { +MusicPlayer::MusicPlayer(bool milesAudio, bool compressedCD) : _isGM(false),_milesAudioMode(false) { + MusicType musicType; if (milesAudio) { MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB | MDT_PREFER_MT32); - MusicType musicType = MidiDriver::getMusicType(dev); + musicType = MidiDriver::getMusicType(dev); switch (musicType) { case MT_ADLIB: _milesAudioMode = true; - _driver = Audio::MidiDriver_Miles_AdLib_create("SAMPLE.AD", "SAMPLE.AD"); + if (compressedCD) { + Common::SeekableReadStream *adLibInstrumentStream = RedReader::loadFromRed("rtzcd.red", "sample.ad"); + _driver = Audio::MidiDriver_Miles_AdLib_create("", "", adLibInstrumentStream); + } else { + _driver = Audio::MidiDriver_Miles_AdLib_create("SAMPLE.AD", "SAMPLE.AD"); + } break; case MT_MT32: _milesAudioMode = true; @@ -56,10 +65,12 @@ MusicPlayer::MusicPlayer(bool milesAudio) : _isGM(false),_milesAudioMode(false) int ret = _driver->open(); if (ret == 0) { - if (_nativeMT32) - _driver->sendMT32Reset(); - else - _driver->sendGMReset(); + if (musicType != MT_ADLIB) { + if (_nativeMT32) + _driver->sendMT32Reset(); + else + _driver->sendGMReset(); + } _driver->setTimerCallback(this, &timerCallback); } diff --git a/engines/made/music.h b/engines/made/music.h index 558b41c2e2..710805d2af 100644 --- a/engines/made/music.h +++ b/engines/made/music.h @@ -38,7 +38,7 @@ enum MusicFlags { class MusicPlayer : public Audio::MidiPlayer { public: - MusicPlayer(bool milesAudio); + MusicPlayer(bool milesAudio, bool compressedCD); void playXMIDI(GenericResource *midiResource, MusicFlags flags = MUSIC_NORMAL); void playSMF(GenericResource *midiResource, MusicFlags flags = MUSIC_NORMAL); -- cgit v1.2.3