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 /engines/mohawk/sound.cpp | |
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
Diffstat (limited to 'engines/mohawk/sound.cpp')
-rw-r--r-- | engines/mohawk/sound.cpp | 82 |
1 files changed, 2 insertions, 80 deletions
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; |