aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorJamieson Christian2002-11-18 09:08:45 +0000
committerJamieson Christian2002-11-18 09:08:45 +0000
commit5214cb3463804bda39b10d52e4a7f6ccd943780d (patch)
treec857f7f0c58bfd65bd5e1e0fb03a0b3c2d434419 /sound
parent713f11d99eb28474bcb8b31942c89e9fa8b66575 (diff)
downloadscummvm-rg350-5214cb3463804bda39b10d52e4a7f6ccd943780d.tar.gz
scummvm-rg350-5214cb3463804bda39b10d52e4a7f6ccd943780d.tar.bz2
scummvm-rg350-5214cb3463804bda39b10d52e4a7f6ccd943780d.zip
Added support for volume and pause control to Simon music.
Note that MidiStreamer is now used as a streaming wrapper for ALL MidiDriver types, even those that natively support streaming. This is because MidiStreamer supports a hybrid of streamed and non-streamed MIDI, which is necessary to support interactive events. svn-id: r5596
Diffstat (limited to 'sound')
-rw-r--r--sound/midistreamer.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/sound/midistreamer.cpp b/sound/midistreamer.cpp
index bb94ca2eef..fcd4109c81 100644
--- a/sound/midistreamer.cpp
+++ b/sound/midistreamer.cpp
@@ -30,8 +30,8 @@ private:
MidiDriver *_target;
StreamCallback *_stream_proc;
void *_stream_param;
- int _mode;
- bool _paused;
+ volatile int _mode;
+ volatile bool _paused;
MidiEvent _events [64];
int _event_count;
@@ -52,7 +52,7 @@ public:
int open(int mode);
void close();
- void send(uint32 b) { _target->send (b); }
+ void send(uint32 b) { if (_mode) _target->send (b); }
void pause(bool p) { _paused = p; }
void set_stream_callback(void *param, StreamCallback *sc);
void setPitchBendRange (byte channel, uint range) { _target->setPitchBendRange (channel, range); }
@@ -87,6 +87,7 @@ int MidiStreamer::timer_thread (void *param) {
MidiStreamer *mid = (MidiStreamer *) param;
int old_time, cur_time;
while (mid->_mode) {
+ g_system->delay_msecs (100);
while (!mid->_stream_proc);
old_time = g_system->get_msecs();
while (!mid->_paused) {
@@ -104,7 +105,7 @@ int MidiStreamer::timer_thread (void *param) {
// just to catch anything still playing.
int i;
for (i = 0; i < 16; ++i)
- mid->send ((0x7B << 8) | 0xB0 | i);
+ mid->_target->send ((0x7B << 8) | 0xB0 | i);
mid->_active = false;
return 0;
}