diff options
author | Bastien Bouclet | 2018-05-17 20:46:42 +0200 |
---|---|---|
committer | Bastien Bouclet | 2018-05-17 20:49:28 +0200 |
commit | 2a02e0311d6d958d5aa2a71c80677beeeb369a95 (patch) | |
tree | fed3be3c2df538a19bf98049b9869ff31ebbf2a0 | |
parent | 5090b6cbbbbabad7443ee653cabd38594c3186ca (diff) | |
download | scummvm-rg350-2a02e0311d6d958d5aa2a71c80677beeeb369a95.tar.gz scummvm-rg350-2a02e0311d6d958d5aa2a71c80677beeeb369a95.tar.bz2 scummvm-rg350-2a02e0311d6d958d5aa2a71c80677beeeb369a95.zip |
MOHAWK: Remove midi playback
This was unused and not touched for many years
-rw-r--r-- | engines/mohawk/detection_tables.h | 20 | ||||
-rw-r--r-- | engines/mohawk/mohawk.h | 3 | ||||
-rw-r--r-- | engines/mohawk/sound.cpp | 82 | ||||
-rw-r--r-- | engines/mohawk/sound.h | 6 |
4 files changed, 13 insertions, 98 deletions
diff --git a/engines/mohawk/detection_tables.h b/engines/mohawk/detection_tables.h index 6dac0b8bba..31c81466c1 100644 --- a/engines/mohawk/detection_tables.h +++ b/engines/mohawk/detection_tables.h @@ -630,7 +630,7 @@ static const MohawkGameDescription gameDescriptions[] = { GUIO1(GUIO_NOASPECT) }, GType_ZOOMBINI, - GF_HASMIDI, + 0, 0 }, @@ -645,7 +645,7 @@ static const MohawkGameDescription gameDescriptions[] = { GUIO1(GUIO_NOASPECT) }, GType_ZOOMBINI, - GF_HASMIDI, + 0, 0 }, @@ -660,7 +660,7 @@ static const MohawkGameDescription gameDescriptions[] = { GUIO1(GUIO_NOASPECT) }, GType_ZOOMBINI, - GF_HASMIDI, + 0, 0 }, @@ -675,7 +675,7 @@ static const MohawkGameDescription gameDescriptions[] = { GUIO1(GUIO_NOASPECT) }, GType_ZOOMBINI, - GF_HASMIDI, + 0, 0 }, @@ -690,7 +690,7 @@ static const MohawkGameDescription gameDescriptions[] = { GUIO1(GUIO_NOASPECT) }, GType_ZOOMBINI, - GF_HASMIDI, + 0, 0 }, @@ -962,7 +962,7 @@ static const MohawkGameDescription gameDescriptions[] = { GUIO1(GUIO_NOASPECT) }, GType_JAMESMATH, - GF_HASMIDI, + 0, 0 }, @@ -978,7 +978,7 @@ static const MohawkGameDescription gameDescriptions[] = { GUIO1(GUIO_NOASPECT) }, GType_JAMESMATH, - GF_HASMIDI, + 0, 0 }, @@ -993,7 +993,7 @@ static const MohawkGameDescription gameDescriptions[] = { GUIO1(GUIO_NOASPECT) }, GType_TREEHOUSE, - GF_HASMIDI, + 0, 0 }, @@ -1115,7 +1115,7 @@ static const MohawkGameDescription gameDescriptions[] = { GUIO1(GUIO_NOASPECT) }, GType_1STDEGREE, - GF_HASMIDI, + 0, 0 }, @@ -1133,7 +1133,7 @@ static const MohawkGameDescription gameDescriptions[] = { GUIO1(GUIO_NOASPECT) }, GType_1STDEGREE, - GF_HASMIDI, + 0, 0 }, diff --git a/engines/mohawk/mohawk.h b/engines/mohawk/mohawk.h index a3583a551f..880863b9b0 100644 --- a/engines/mohawk/mohawk.h +++ b/engines/mohawk/mohawk.h @@ -68,8 +68,7 @@ enum MohawkGameFeatures { GF_ME = (1 << 0), // Myst Masterpiece Edition GF_DVD = (1 << 1), GF_DEMO = (1 << 2), - GF_HASMIDI = (1 << 3), - GF_LB_10 = (1 << 4) // very early Living Books 1.0 games + GF_LB_10 = (1 << 3) // very early Living Books 1.0 games }; struct MohawkGameDescription; diff --git a/engines/mohawk/sound.cpp b/engines/mohawk/sound.cpp index 5e0cae1492..2b9047c3a7 100644 --- a/engines/mohawk/sound.cpp +++ b/engines/mohawk/sound.cpp @@ -180,42 +180,12 @@ Audio::RewindableAudioStream *makeMohawkWaveStream(Common::SeekableReadStream *s return nullptr; } -Sound::Sound(MohawkEngine* vm) : _vm(vm) { - _midiDriver = nullptr; - _midiParser = nullptr; - _midiData = nullptr; - initMidi(); +Sound::Sound(MohawkEngine* vm) : + _vm(vm) { } Sound::~Sound() { stopSound(); - - if (_midiParser) { - _midiParser->unloadMusic(); - delete _midiParser; - } - - if (_midiDriver) { - _midiDriver->close(); - delete _midiDriver; - } - - if (_midiData) - delete[] _midiData; -} - -void Sound::initMidi() { - if (!(_vm->getFeatures() & GF_HASMIDI)) - return; - - // Let's get our MIDI parser/driver - _midiParser = MidiParser::createParser_SMF(); - _midiDriver = MidiDriver::createMidi(MidiDriver::detectDevice(MDT_ADLIB|MDT_MIDI)); - - // Set up everything! - _midiDriver->open(); - _midiParser->setMidiDriver(_midiDriver); - _midiParser->setTimerRate(_midiDriver->getBaseTempo()); } Audio::RewindableAudioStream *Sound::makeAudioStream(uint16 id, CueList *cueList) { @@ -264,54 +234,6 @@ Audio::SoundHandle *Sound::playSound(uint16 id, byte volume, bool loop, CueList return nullptr; } -void Sound::playMidi(uint16 id) { - uint32 idTag; - if (!(_vm->getFeatures() & GF_HASMIDI)) { - warning ("Attempting to play MIDI in a game without MIDI"); - return; - } - - assert(_midiDriver && _midiParser); - - _midiParser->unloadMusic(); - if (_midiData) - delete[] _midiData; - - Common::SeekableReadStream *midi = _vm->getResource(ID_TMID, id); - - idTag = midi->readUint32BE(); - assert(idTag == ID_MHWK); - midi->readUint32BE(); // Skip size - idTag = midi->readUint32BE(); - assert(idTag == ID_MIDI); - - _midiData = new byte[midi->size() - 12]; // Enough to cover MThd/Prg#/MTrk - - // Read the MThd Data - midi->read(_midiData, 14); - - // TODO: Load patches from the Prg# section... skip it for now. - idTag = midi->readUint32BE(); - assert(idTag == ID_PRG); - midi->skip(midi->readUint32BE()); - - // Read the MTrk Data - uint32 mtrkSize = midi->size() - midi->pos(); - midi->read(_midiData + 14, mtrkSize); - - delete midi; - - // Now, play it :) - if (!_midiParser->loadMusic(_midiData, 14 + mtrkSize)) - error ("Could not play MIDI music from tMID %04x\n", id); - - _midiDriver->setTimerCallback(_midiParser, MidiParser::timerCallback); -} - -void Sound::stopMidi() { - _midiParser->unloadMusic(); -} - Audio::RewindableAudioStream *Sound::makeLivingBooksWaveStream_v1(Common::SeekableReadStream *stream) { uint16 header = stream->readUint16BE(); uint16 rate = 0; diff --git a/engines/mohawk/sound.h b/engines/mohawk/sound.h index 15bda0792e..15ee249177 100644 --- a/engines/mohawk/sound.h +++ b/engines/mohawk/sound.h @@ -107,8 +107,6 @@ public: // Generic sound functions Audio::SoundHandle *playSound(uint16 id, byte volume = Audio::Mixer::kMaxChannelVolume, bool loop = false, CueList *cueList = NULL); - void playMidi(uint16 id); - void stopMidi(); void stopSound(); void stopSound(uint16 id); bool isPlaying(uint16 id); @@ -117,12 +115,8 @@ public: private: MohawkEngine *_vm; - MidiDriver *_midiDriver; - MidiParser *_midiParser; - byte *_midiData; static Audio::RewindableAudioStream *makeLivingBooksWaveStream_v1(Common::SeekableReadStream *stream); - void initMidi(); Common::Array<SndHandle> _handles; SndHandle *getHandle(); |