From d24e7706057aaf5d20c31d6eebf6e55440cfb20a Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 9 Jul 2008 10:42:47 +0000 Subject: cleanup / code formatting svn-id: r32973 --- sound/midiparser_smf.cpp | 25 ++++++++++++++++++++----- sound/midiparser_xmidi.cpp | 22 +++++++++++++++------- 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/sound/midiparser_smf.cpp b/sound/midiparser_smf.cpp index ed5007ecb7..89b7d3f525 100644 --- a/sound/midiparser_smf.cpp +++ b/sound/midiparser_smf.cpp @@ -85,16 +85,26 @@ void MidiParser_SMF::parseNextEvent(EventInfo &info) { _position._running_status = info.event; switch (info.command()) { - case 0xC: case 0xD: + case 0x9: // Note On + info.basic.param1 = *(_position._play_pos++); + info.basic.param2 = *(_position._play_pos++); + if (info.basic.param2 == 0) + info.event = info.channel() | 0x80; + info.length = 0; + break; + + case 0xC: + case 0xD: info.basic.param1 = *(_position._play_pos++); info.basic.param2 = 0; break; - case 0x8: case 0x9: case 0xA: case 0xB: case 0xE: + case 0x8: + case 0xA: + case 0xB: + case 0xE: info.basic.param1 = *(_position._play_pos++); info.basic.param2 = *(_position._play_pos++); - if (info.command() == 0x9 && info.basic.param2 == 0) - info.event = info.channel() | 0x80; info.length = 0; break; @@ -110,7 +120,12 @@ void MidiParser_SMF::parseNextEvent(EventInfo &info) { info.basic.param2 = 0; break; - case 0x6: case 0x8: case 0xA: case 0xB: case 0xC: case 0xE: + case 0x6: + case 0x8: + case 0xA: + case 0xB: + case 0xC: + case 0xE: info.basic.param1 = info.basic.param2 = 0; break; diff --git a/sound/midiparser_xmidi.cpp b/sound/midiparser_xmidi.cpp index f28c824a8e..7cf114dcc6 100644 --- a/sound/midiparser_xmidi.cpp +++ b/sound/midiparser_xmidi.cpp @@ -86,11 +86,19 @@ void MidiParser_XMIDI::parseNextEvent(EventInfo &info) { } break; - case 0xC: case 0xD: + case 0xC: + case 0xD: info.basic.param1 = *(_position._play_pos++); info.basic.param2 = 0; break; + case 0x8: + case 0xA: + case 0xE: + info.basic.param1 = *(_position._play_pos++); + info.basic.param2 = *(_position._play_pos++); + break; + case 0xB: info.basic.param1 = *(_position._play_pos++); info.basic.param2 = *(_position._play_pos++); @@ -128,11 +136,6 @@ void MidiParser_XMIDI::parseNextEvent(EventInfo &info) { } break; - case 0x8: case 0xA: case 0xE: - info.basic.param1 = *(_position._play_pos++); - info.basic.param2 = *(_position._play_pos++); - break; - case 0xF: // Meta or SysEx event switch (info.event & 0x0F) { case 0x2: // Song Position Pointer @@ -145,7 +148,12 @@ void MidiParser_XMIDI::parseNextEvent(EventInfo &info) { info.basic.param2 = 0; break; - case 0x6: case 0x8: case 0xA: case 0xB: case 0xC: case 0xE: + case 0x6: + case 0x8: + case 0xA: + case 0xB: + case 0xC: + case 0xE: info.basic.param1 = info.basic.param2 = 0; break; -- cgit v1.2.3