diff options
author | eriktorbjorn | 2011-05-08 07:30:06 +0200 |
---|---|---|
committer | eriktorbjorn | 2011-05-08 07:34:46 +0200 |
commit | 3b2c3907a068fa0cea366a5e1cf47a23abb170ca (patch) | |
tree | 5a1cf72dd0621089212113af2b8f11808adadd63 /backends/midi | |
parent | e28b402295b92e080274a8b39869dd5f63c195f1 (diff) | |
download | scummvm-rg350-3b2c3907a068fa0cea366a5e1cf47a23abb170ca.tar.gz scummvm-rg350-3b2c3907a068fa0cea366a5e1cf47a23abb170ca.tar.bz2 scummvm-rg350-3b2c3907a068fa0cea366a5e1cf47a23abb170ca.zip |
ALSA: Warn if events or SysEx messages are received when not open.
This should make it easier to spot errors like the one spotted in
the Queen engine yesterday. The Windows MIDI driver already seems
to do something like this; I don't know about the others.
Diffstat (limited to 'backends/midi')
-rw-r--r-- | backends/midi/alsa.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/backends/midi/alsa.cpp b/backends/midi/alsa.cpp index 5110734a18..bc8fab6a56 100644 --- a/backends/midi/alsa.cpp +++ b/backends/midi/alsa.cpp @@ -183,6 +183,11 @@ void MidiDriver_ALSA::close() { } void MidiDriver_ALSA::send(uint32 b) { + if (!_isOpen) { + warning("MidiDriver_ALSA: Got event while not open"); + return; + } + unsigned int midiCmd[4]; ev.type = SND_SEQ_EVENT_OSS; @@ -256,6 +261,11 @@ void MidiDriver_ALSA::send(uint32 b) { } void MidiDriver_ALSA::sysEx(const byte *msg, uint16 length) { + if (!_isOpen) { + warning("MidiDriver_ALSA: Got SysEx while not open"); + return; + } + unsigned char buf[266]; assert(length + 2 <= ARRAYSIZE(buf)); |