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 |
11 namespace media { | 11 namespace media { |
| 12 namespace midi { |
12 | 13 |
13 UsbMidiOutputStream::UsbMidiOutputStream(const UsbMidiJack& jack) | 14 UsbMidiOutputStream::UsbMidiOutputStream(const UsbMidiJack& jack) |
14 : jack_(jack), pending_size_(0), is_sending_sysex_(false) {} | 15 : jack_(jack), pending_size_(0), is_sending_sysex_(false) {} |
15 | 16 |
16 void UsbMidiOutputStream::Send(const std::vector<uint8>& data) { | 17 void UsbMidiOutputStream::Send(const std::vector<uint8>& data) { |
17 // To prevent link errors caused by DCHECK_*. | 18 // To prevent link errors caused by DCHECK_*. |
18 const size_t kPacketContentSize = UsbMidiOutputStream::kPacketContentSize; | 19 const size_t kPacketContentSize = UsbMidiOutputStream::kPacketContentSize; |
19 DCHECK_LT(jack_.cable_number, 16u); | 20 DCHECK_LT(jack_.cable_number, 16u); |
20 | 21 |
21 std::vector<uint8> data_to_send; | 22 std::vector<uint8> data_to_send; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 return false; | 184 return false; |
184 } | 185 } |
185 | 186 |
186 data_to_send->push_back((jack_.cable_number << 4) | code_index); | 187 data_to_send->push_back((jack_.cable_number << 4) | code_index); |
187 for (size_t i = index; i < index + 3; ++i) | 188 for (size_t i = index; i < index + 3; ++i) |
188 data_to_send->push_back(i < index + message_size ? Get(data, i) : 0); | 189 data_to_send->push_back(i < index + message_size ? Get(data, i) : 0); |
189 *current += message_size; | 190 *current += message_size; |
190 return true; | 191 return true; |
191 } | 192 } |
192 | 193 |
| 194 } // namespace midi |
193 } // namespace media | 195 } // namespace media |
OLD | NEW |