aboutsummaryrefslogtreecommitdiff
path: root/audio/midiparser_xmidi.cpp
diff options
context:
space:
mode:
authorAlyssa Milburn2012-09-07 22:57:14 +0200
committerAlyssa Milburn2012-09-07 23:04:34 +0200
commitf08978a0750e6a6a5dbea1f8fe5d80267049f8c8 (patch)
tree2e13589ef3dc97ea5a7b935277ed2cb5d739e67e /audio/midiparser_xmidi.cpp
parent5684475169a371f0b09c9550901279ade10f5275 (diff)
downloadscummvm-rg350-f08978a0750e6a6a5dbea1f8fe5d80267049f8c8.tar.gz
scummvm-rg350-f08978a0750e6a6a5dbea1f8fe5d80267049f8c8.tar.bz2
scummvm-rg350-f08978a0750e6a6a5dbea1f8fe5d80267049f8c8.zip
JANITORIAL: Remove underscores from MidiParser variable names.
Diffstat (limited to 'audio/midiparser_xmidi.cpp')
-rw-r--r--audio/midiparser_xmidi.cpp86
1 files changed, 43 insertions, 43 deletions
diff --git a/audio/midiparser_xmidi.cpp b/audio/midiparser_xmidi.cpp
index f0b2d0c6fc..11690b0214 100644
--- a/audio/midiparser_xmidi.cpp
+++ b/audio/midiparser_xmidi.cpp
@@ -65,16 +65,16 @@ uint32 MidiParser_XMIDI::readVLQ2(byte * &pos) {
}
void MidiParser_XMIDI::parseNextEvent(EventInfo &info) {
- info.start = _position._play_pos;
- info.delta = readVLQ2(_position._play_pos);
+ info.start = _position._playPos;
+ info.delta = readVLQ2(_position._playPos);
// Process the next event.
- info.event = *(_position._play_pos++);
+ info.event = *(_position._playPos++);
switch (info.event >> 4) {
case 0x9: // Note On
- info.basic.param1 = *(_position._play_pos++);
- info.basic.param2 = *(_position._play_pos++);
- info.length = readVLQ(_position._play_pos);
+ info.basic.param1 = *(_position._playPos++);
+ info.basic.param2 = *(_position._playPos++);
+ info.length = readVLQ(_position._playPos);
if (info.basic.param2 == 0) {
info.event = info.channel() | 0x80;
info.length = 0;
@@ -83,20 +83,20 @@ void MidiParser_XMIDI::parseNextEvent(EventInfo &info) {
case 0xC:
case 0xD:
- info.basic.param1 = *(_position._play_pos++);
+ info.basic.param1 = *(_position._playPos++);
info.basic.param2 = 0;
break;
case 0x8:
case 0xA:
case 0xE:
- info.basic.param1 = *(_position._play_pos++);
- info.basic.param2 = *(_position._play_pos++);
+ info.basic.param1 = *(_position._playPos++);
+ info.basic.param2 = *(_position._playPos++);
break;
case 0xB:
- info.basic.param1 = *(_position._play_pos++);
- info.basic.param2 = *(_position._play_pos++);
+ info.basic.param1 = *(_position._playPos++);
+ info.basic.param2 = *(_position._playPos++);
// This isn't a full XMIDI implementation, but it should
// hopefully be "good enough" for most things.
@@ -104,7 +104,7 @@ void MidiParser_XMIDI::parseNextEvent(EventInfo &info) {
switch (info.basic.param1) {
// Simplified XMIDI looping.
case 0x74: { // XMIDI_CONTROLLER_FOR_LOOP
- byte *pos = _position._play_pos;
+ byte *pos = _position._playPos;
if (_loopCount < ARRAYSIZE(_loop) - 1)
_loopCount++;
else
@@ -126,9 +126,9 @@ void MidiParser_XMIDI::parseNextEvent(EventInfo &info) {
if (--_loop[_loopCount].repeat == 0)
_loopCount--;
else
- _position._play_pos = _loop[_loopCount].pos;
+ _position._playPos = _loop[_loopCount].pos;
} else {
- _position._play_pos = _loop[_loopCount].pos;
+ _position._playPos = _loop[_loopCount].pos;
}
}
}
@@ -164,12 +164,12 @@ void MidiParser_XMIDI::parseNextEvent(EventInfo &info) {
case 0xF: // Meta or SysEx event
switch (info.event & 0x0F) {
case 0x2: // Song Position Pointer
- info.basic.param1 = *(_position._play_pos++);
- info.basic.param2 = *(_position._play_pos++);
+ info.basic.param1 = *(_position._playPos++);
+ info.basic.param2 = *(_position._playPos++);
break;
case 0x3: // Song Select
- info.basic.param1 = *(_position._play_pos++);
+ info.basic.param1 = *(_position._playPos++);
info.basic.param2 = 0;
break;
@@ -183,16 +183,16 @@ void MidiParser_XMIDI::parseNextEvent(EventInfo &info) {
break;
case 0x0: // SysEx
- info.length = readVLQ(_position._play_pos);
- info.ext.data = _position._play_pos;
- _position._play_pos += info.length;
+ info.length = readVLQ(_position._playPos);
+ info.ext.data = _position._playPos;
+ _position._playPos += info.length;
break;
case 0xF: // META event
- info.ext.type = *(_position._play_pos++);
- info.length = readVLQ(_position._play_pos);
- info.ext.data = _position._play_pos;
- _position._play_pos += info.length;
+ info.ext.type = *(_position._playPos++);
+ info.length = readVLQ(_position._playPos);
+ info.ext.data = _position._playPos;
+ _position._playPos += info.length;
if (info.ext.type == 0x51 && info.length == 3) {
// Tempo event. We want to make these constant 500,000.
info.ext.data[0] = 0x07;
@@ -211,7 +211,7 @@ bool MidiParser_XMIDI::loadMusic(byte *data, uint32 size) {
uint32 i = 0;
byte *start;
uint32 len;
- uint32 chunk_len;
+ uint32 chunkLen;
char buf[32];
_loopCount = -1;
@@ -230,7 +230,7 @@ bool MidiParser_XMIDI::loadMusic(byte *data, uint32 size) {
if (!memcmp(pos, "XMID", 4)) {
warning("XMIDI doesn't have XDIR");
pos += 4;
- _num_tracks = 1;
+ _numTracks = 1;
} else if (memcmp(pos, "XDIR", 4)) {
// Not an XMIDI that we recognize
warning("Expected 'XDIR' but found '%c%c%c%c'", pos[0], pos[1], pos[2], pos[3]);
@@ -238,7 +238,7 @@ bool MidiParser_XMIDI::loadMusic(byte *data, uint32 size) {
} else {
// Seems Valid
pos += 4;
- _num_tracks = 0;
+ _numTracks = 0;
for (i = 4; i < len; i++) {
// Read 4 bytes of type
@@ -246,34 +246,34 @@ bool MidiParser_XMIDI::loadMusic(byte *data, uint32 size) {
pos += 4;
// Read length of chunk
- chunk_len = read4high(pos);
+ chunkLen = read4high(pos);
// Add eight bytes
i += 8;
if (memcmp(buf, "INFO", 4) == 0) {
// Must be at least 2 bytes long
- if (chunk_len < 2) {
- warning("Invalid chunk length %d for 'INFO' block", (int)chunk_len);
+ if (chunkLen < 2) {
+ warning("Invalid chunk length %d for 'INFO' block", (int)chunkLen);
return false;
}
- _num_tracks = (byte)read2low(pos);
+ _numTracks = (byte)read2low(pos);
- if (chunk_len > 2) {
- warning("Chunk length %d is greater than 2", (int)chunk_len);
- //pos += chunk_len - 2;
+ if (chunkLen > 2) {
+ warning("Chunk length %d is greater than 2", (int)chunkLen);
+ //pos += chunkLen - 2;
}
break;
}
// Must align
- pos += (chunk_len + 1) & ~1;
- i += (chunk_len + 1) & ~1;
+ pos += (chunkLen + 1) & ~1;
+ i += (chunkLen + 1) & ~1;
}
// Didn't get to fill the header
- if (_num_tracks == 0) {
+ if (_numTracks == 0) {
warning("Didn't find a valid track count");
return false;
}
@@ -303,13 +303,13 @@ bool MidiParser_XMIDI::loadMusic(byte *data, uint32 size) {
// Ok it's an XMIDI.
// We're going to identify and store the location for each track.
- if (_num_tracks > ARRAYSIZE(_tracks)) {
- warning("Can only handle %d tracks but was handed %d", (int)ARRAYSIZE(_tracks), (int)_num_tracks);
+ if (_numTracks > ARRAYSIZE(_tracks)) {
+ warning("Can only handle %d tracks but was handed %d", (int)ARRAYSIZE(_tracks), (int)_numTracks);
return false;
}
- int tracks_read = 0;
- while (tracks_read < _num_tracks) {
+ int tracksRead = 0;
+ while (tracksRead < _numTracks) {
if (!memcmp(pos, "FORM", 4)) {
// Skip this plus the 4 bytes after it.
pos += 8;
@@ -325,11 +325,11 @@ bool MidiParser_XMIDI::loadMusic(byte *data, uint32 size) {
pos += (len + 1) & ~1;
} else if (!memcmp(pos, "EVNT", 4)) {
// Ahh! What we're looking for at last.
- _tracks[tracks_read] = pos + 8; // Skip the EVNT and length bytes
+ _tracks[tracksRead] = pos + 8; // Skip the EVNT and length bytes
pos += 4;
len = read4high(pos);
pos += (len + 1) & ~1;
- ++tracks_read;
+ ++tracksRead;
} else {
warning("Hit invalid block '%c%c%c%c' while scanning for track locations", pos[0], pos[1], pos[2], pos[3]);
return false;