OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/midi/usb_midi_output_stream.h" | 5 #include "media/midi/usb_midi_output_stream.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "media/midi/midi_message_util.h" | 8 #include "media/midi/midi_message_util.h" |
9 #include "media/midi/usb_midi_device.h" | 9 #include "media/midi/usb_midi_device.h" |
10 | 10 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 uint8 byte = Get(data, index); | 91 uint8 byte = Get(data, index); |
92 if ((byte & kSysRTMessageBitMask) == kSysRTMessageBitPattern) { | 92 if ((byte & kSysRTMessageBitMask) == kSysRTMessageBitPattern) { |
93 // System Real-Time messages interleaved in a SysEx message | 93 // System Real-Time messages interleaved in a SysEx message |
94 PushSysRTMessage(data, &index, data_to_send); | 94 PushSysRTMessage(data, &index, data_to_send); |
95 continue; | 95 continue; |
96 } | 96 } |
97 | 97 |
98 message[message_size] = byte; | 98 message[message_size] = byte; |
99 ++message_size; | 99 ++message_size; |
100 if (byte == kEndOfSysExByte) { | 100 if (byte == kEndOfSysExByte) { |
101 uint8 code_index = message_size + 0x4; | 101 uint8 code_index = static_cast<uint8>(message_size) + 0x4; |
102 DCHECK(code_index == 0x5 || code_index == 0x6 || code_index == 0x7); | 102 DCHECK(code_index == 0x5 || code_index == 0x6 || code_index == 0x7); |
103 data_to_send->push_back((jack_.cable_number << 4) | code_index); | 103 data_to_send->push_back((jack_.cable_number << 4) | code_index); |
104 data_to_send->insert(data_to_send->end(), | 104 data_to_send->insert(data_to_send->end(), |
105 message, | 105 message, |
106 message + arraysize(message)); | 106 message + arraysize(message)); |
107 *current = index + 1; | 107 *current = index + 1; |
108 is_sending_sysex_ = false; | 108 is_sending_sysex_ = false; |
109 return true; | 109 return true; |
110 } | 110 } |
111 ++index; | 111 ++index; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 } | 184 } |
185 | 185 |
186 data_to_send->push_back((jack_.cable_number << 4) | code_index); | 186 data_to_send->push_back((jack_.cable_number << 4) | code_index); |
187 for (size_t i = index; i < index + 3; ++i) | 187 for (size_t i = index; i < index + 3; ++i) |
188 data_to_send->push_back(i < index + message_size ? Get(data, i) : 0); | 188 data_to_send->push_back(i < index + message_size ? Get(data, i) : 0); |
189 *current += message_size; | 189 *current += message_size; |
190 return true; | 190 return true; |
191 } | 191 } |
192 | 192 |
193 } // namespace media | 193 } // namespace media |
OLD | NEW |