diff options
author | Benjamin Haisch | 2008-05-05 12:51:50 +0000 |
---|---|---|
committer | Benjamin Haisch | 2008-05-05 12:51:50 +0000 |
commit | 7191b2c5158615fe46c7587b9645c7f295d993ec (patch) | |
tree | 2997ab9a58cd6900bba4127c04b6e410717490a2 /engines/made/music.cpp | |
parent | 1ddd54b50da3f67f39c7adfa63f6858b85c610e9 (diff) | |
download | scummvm-rg350-7191b2c5158615fe46c7587b9645c7f295d993ec.tar.gz scummvm-rg350-7191b2c5158615fe46c7587b9645c7f295d993ec.tar.bz2 scummvm-rg350-7191b2c5158615fe46c7587b9645c7f295d993ec.zip |
Added MIDI playback (which doesn't work yet) and fixed compilation (sorry all)
svn-id: r31873
Diffstat (limited to 'engines/made/music.cpp')
-rw-r--r-- | engines/made/music.cpp | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/engines/made/music.cpp b/engines/made/music.cpp index 1b51fb3b80..c3b36d3b8c 100644 --- a/engines/made/music.cpp +++ b/engines/made/music.cpp @@ -42,6 +42,7 @@ MusicPlayer::MusicPlayer(MidiDriver *driver) : _parser(0), _driver(driver), _loo _masterVolume = 0; this->open(); _xmidiParser = MidiParser::createParser_XMIDI(); + _smfParser = MidiParser::createParser_SMF(); } MusicPlayer::~MusicPlayer() { @@ -49,7 +50,9 @@ MusicPlayer::~MusicPlayer() { stop(); this->close(); _xmidiParser->setMidiDriver(NULL); + _smfParser->setMidiDriver(NULL); delete _xmidiParser; + delete _smfParser; } void MusicPlayer::setVolume(int volume) { @@ -140,13 +143,13 @@ void MusicPlayer::onTimer(void *refCon) { music->_parser->onTimer(); } -void MusicPlayer::play(XmidiResource *midiResource, MusicFlags flags) { +void MusicPlayer::playXMIDI(GenericResource *midiResource, MusicFlags flags) { if (_isPlaying) return; stop(); - // Load MIDI/XMI resource data + // Load XMID resource data _isGM = true; @@ -166,6 +169,32 @@ void MusicPlayer::play(XmidiResource *midiResource, MusicFlags flags) { } } +void MusicPlayer::playSMF(GenericResource *midiResource, MusicFlags flags) { + if (_isPlaying) + return; + + stop(); + + // Load MIDI resource data + + _isGM = true; + + if (_smfParser->loadMusic(midiResource->getData(), midiResource->getSize())) { + MidiParser *parser = _smfParser; + parser->setTrack(0); + parser->setMidiDriver(this); + parser->setTimerRate(getBaseTempo()); + parser->property(MidiParser::mpCenterPitchWheelOnUnload, 1); + + _parser = parser; + + setVolume(255); + + _looping = flags & MUSIC_LOOP; + _isPlaying = true; + } +} + void MusicPlayer::stop() { Common::StackLock lock(_mutex); |