| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 } | 140 } |
| 141 return false; | 141 return false; |
| 142 } | 142 } |
| 143 | 143 |
| 144 bool acceptCurrentMessage() | 144 bool acceptCurrentMessage() |
| 145 { | 145 { |
| 146 DCHECK(isStatusByte()); | 146 DCHECK(isStatusByte()); |
| 147 DCHECK(!isSysex()); | 147 DCHECK(!isSysex()); |
| 148 DCHECK(!isReservedStatusByte()); | 148 DCHECK(!isReservedStatusByte()); |
| 149 DCHECK(!isRealTimeMessage()); | 149 DCHECK(!isRealTimeMessage()); |
| 150 DCHECK(!isEndOfSysex()); |
| 150 static const int channelMessageLength[7] = { 3, 3, 3, 3, 2, 2, 3 }; // f
or 0x8*, 0x9*, ..., 0xe* | 151 static const int channelMessageLength[7] = { 3, 3, 3, 3, 2, 2, 3 }; // f
or 0x8*, 0x9*, ..., 0xe* |
| 151 static const int systemMessageLength[7] = { 2, 3, 2, 0, 0, 1, 0 }; // fo
r 0xf1, 0xf2, ..., 0xf7 | 152 static const int systemMessageLength[7] = { 2, 3, 2, 0, 0, 1, 0 }; // fo
r 0xf1, 0xf2, ..., 0xf7 |
| 152 size_t length = isSystemMessage() ? systemMessageLength[m_data[m_offset]
- 0xf1] : channelMessageLength[(m_data[m_offset] >> 4) - 8]; | 153 size_t length = isSystemMessage() ? systemMessageLength[m_data[m_offset]
- 0xf1] : channelMessageLength[(m_data[m_offset] >> 4) - 8]; |
| 153 size_t count = 1; | 154 m_offset++; |
| 154 for (m_offset++; !isEndOfData(); m_offset++) { | 155 DCHECK_GT(length, 0UL); |
| 156 if (length == 1) |
| 157 return true; |
| 158 for (size_t count = 1; !isEndOfData(); m_offset++) { |
| 155 if (isReservedStatusByte()) | 159 if (isReservedStatusByte()) |
| 156 return false; | 160 return false; |
| 157 if (isRealTimeMessage()) | 161 if (isRealTimeMessage()) |
| 158 continue; | 162 continue; |
| 159 if (isStatusByte()) | 163 if (isStatusByte()) |
| 160 return false; | 164 return false; |
| 161 if (++count == length) { | 165 if (++count == length) { |
| 162 m_offset++; | 166 m_offset++; |
| 163 return true; | 167 return true; |
| 164 } | 168 } |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 { | 243 { |
| 240 send(unsignedData, 0.0, exceptionState); | 244 send(unsignedData, 0.0, exceptionState); |
| 241 } | 245 } |
| 242 | 246 |
| 243 DEFINE_TRACE(MIDIOutput) | 247 DEFINE_TRACE(MIDIOutput) |
| 244 { | 248 { |
| 245 MIDIPort::trace(visitor); | 249 MIDIPort::trace(visitor); |
| 246 } | 250 } |
| 247 | 251 |
| 248 } // namespace blink | 252 } // namespace blink |
| OLD | NEW |