| 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 #ifndef MEDIA_MIDI_USB_MIDI_OUTPUT_STREAM_H_ | 5 #ifndef MEDIA_MIDI_USB_MIDI_OUTPUT_STREAM_H_ |
| 6 #define MEDIA_MIDI_USB_MIDI_OUTPUT_STREAM_H_ | 6 #define MEDIA_MIDI_USB_MIDI_OUTPUT_STREAM_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "media/base/media_export.h" | 11 #include "media/base/media_export.h" |
| 12 #include "media/midi/usb_midi_jack.h" | 12 #include "media/midi/usb_midi_jack.h" |
| 13 | 13 |
| 14 namespace media { | 14 namespace media { |
| 15 | 15 |
| 16 // UsbMidiOutputStream converts MIDI data to USB-MIDI data. | 16 // UsbMidiOutputStream converts MIDI data to USB-MIDI data. |
| 17 // See "USB Device Class Definition for MIDI Devices" Release 1.0, | 17 // See "USB Device Class Definition for MIDI Devices" Release 1.0, |
| 18 // Section 4 "USB-MIDI Event Packets" for details. | 18 // Section 4 "USB-MIDI Event Packets" for details. |
| 19 class MEDIA_EXPORT UsbMidiOutputStream { | 19 class MEDIA_EXPORT UsbMidiOutputStream { |
| 20 public: | 20 public: |
| 21 explicit UsbMidiOutputStream(const UsbMidiJack& jack); | 21 explicit UsbMidiOutputStream(const UsbMidiJack& jack); |
| 22 | 22 |
| 23 // Converts |data| to USB-MIDI data and send it to the jack. | 23 // Converts |data| to USB-MIDI data and send it to the jack. |
| 24 void Send(const std::vector<uint8>& data); | 24 void Send(const std::vector<uint8>& data); |
| 25 | 25 |
| 26 const UsbMidiJack& jack() const { return jack_; } |
| 27 |
| 26 private: | 28 private: |
| 27 size_t GetSize(const std::vector<uint8>& data) const; | 29 size_t GetSize(const std::vector<uint8>& data) const; |
| 28 uint8_t Get(const std::vector<uint8>& data, size_t index) const; | 30 uint8_t Get(const std::vector<uint8>& data, size_t index) const; |
| 29 | 31 |
| 30 bool PushSysExMessage(const std::vector<uint8>& data, | 32 bool PushSysExMessage(const std::vector<uint8>& data, |
| 31 size_t* current, | 33 size_t* current, |
| 32 std::vector<uint8>* data_to_send); | 34 std::vector<uint8>* data_to_send); |
| 33 bool PushSysCommonMessage(const std::vector<uint8>& data, | 35 bool PushSysCommonMessage(const std::vector<uint8>& data, |
| 34 size_t* current, | 36 size_t* current, |
| 35 std::vector<uint8>* data_to_send); | 37 std::vector<uint8>* data_to_send); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 46 size_t pending_size_; | 48 size_t pending_size_; |
| 47 uint8 pending_data_[kPacketContentSize]; | 49 uint8 pending_data_[kPacketContentSize]; |
| 48 bool is_sending_sysex_; | 50 bool is_sending_sysex_; |
| 49 | 51 |
| 50 DISALLOW_COPY_AND_ASSIGN(UsbMidiOutputStream); | 52 DISALLOW_COPY_AND_ASSIGN(UsbMidiOutputStream); |
| 51 }; | 53 }; |
| 52 | 54 |
| 53 } // namespace media | 55 } // namespace media |
| 54 | 56 |
| 55 #endif // MEDIA_MIDI_USB_MIDI_OUTPUT_STREAM_H_ | 57 #endif // MEDIA_MIDI_USB_MIDI_OUTPUT_STREAM_H_ |
| OLD | NEW |