Allow MIDIDecoder to handle multiple messages per pass

This commit is contained in:
Jack Andersen 2018-08-24 22:37:26 -10:00
parent f73e4f08fa
commit fd2a92e2c2
1 changed files with 135 additions and 135 deletions

View File

@ -41,9 +41,8 @@ MIDIDecoder::receiveBytes(std::vector<uint8_t>::const_iterator begin,
std::vector<uint8_t>::const_iterator end) std::vector<uint8_t>::const_iterator end)
{ {
std::vector<uint8_t>::const_iterator it = begin; std::vector<uint8_t>::const_iterator it = begin;
if (it == end) while (it != end)
return begin; {
uint8_t a = *it++; uint8_t a = *it++;
uint8_t b; uint8_t b;
if (a & 0x80) if (a & 0x80)
@ -61,8 +60,7 @@ MIDIDecoder::receiveBytes(std::vector<uint8_t>::const_iterator begin,
uint32_t length; uint32_t length;
_readContinuedValue(it, end, length); _readContinuedValue(it, end, length);
it += length; it += length;
} } else
else
{ {
uint8_t chan = m_status & 0xf; uint8_t chan = m_status & 0xf;
switch (Status(m_status & 0xf0)) switch (Status(m_status & 0xf0))
@ -195,14 +193,16 @@ MIDIDecoder::receiveBytes(std::vector<uint8_t>::const_iterator begin,
case Status::SysExTerm: case Status::SysExTerm:
case Status::TimingClock: case Status::TimingClock:
case Status::ActiveSensing: case Status::ActiveSensing:
default: break; default:
break;
} }
break; break;
} }
default: break; default:
break;
}
} }
} }
return it; return it;
} }