diff options
author | Travis Howell | 2002-11-13 00:24:48 +0000 |
---|---|---|
committer | Travis Howell | 2002-11-13 00:24:48 +0000 |
commit | 5f8cfd62e83ec5b6096fd55241cff8056b3b036b (patch) | |
tree | 17953da65ddb2a1b9c73e6e17b84b160ace7020b /simon/midi.cpp | |
parent | 2ee08ee4696fe18c2b60f351b3adc43349429d0a (diff) | |
download | scummvm-rg350-5f8cfd62e83ec5b6096fd55241cff8056b3b036b.tar.gz scummvm-rg350-5f8cfd62e83ec5b6096fd55241cff8056b3b036b.tar.bz2 scummvm-rg350-5f8cfd62e83ec5b6096fd55241cff8056b3b036b.zip |
Add midi streaming support from Jamieson630
svn-id: r5522
Diffstat (limited to 'simon/midi.cpp')
-rw-r--r-- | simon/midi.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/simon/midi.cpp b/simon/midi.cpp index 5282a7fbf1..391aa5dbfa 100644 --- a/simon/midi.cpp +++ b/simon/midi.cpp @@ -28,6 +28,9 @@ #include "sound/mixer.h" #include "simon/simon.h" +// FIXME: This is a horrible place to put this, but for now.... +#include "sound/midistreamer.cpp" + void MidiPlayer::read_all_songs(File *in) { uint i, num; @@ -178,6 +181,14 @@ void MidiPlayer::initialize() _midiDriver->property(MidiDriver::PROP_TIMEDIV, _songs[0].ppqn); res = _midiDriver->open(MidiDriver::MO_STREAMING); + if (res == MidiDriver::MERR_STREAMING_NOT_AVAILABLE) { + // No direct streaming, slap a front-end on. + _midiDriver = new MidiStreamer (_midiDriver); + _midiDriver->property (MidiDriver::PROP_TIMEDIV, _songs[0].ppqn); + _midiDriver->set_stream_callback (this, on_fill); + res = _midiDriver->open (MidiDriver::MO_STREAMING); + } + if (res != 0) error("MidiPlayer::initializer, got %s", MidiDriver::get_error_name(res)); } @@ -408,5 +419,5 @@ void MidiPlayer::play() void MidiPlayer::set_driver(MidiDriver *md) { _midiDriver = md; - md->set_stream_callback(this, on_fill); + _midiDriver->set_stream_callback(this, on_fill); } |