| 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_JACK_H_ | 5 #ifndef MEDIA_MIDI_USB_MIDI_JACK_H_ |
| 6 #define MEDIA_MIDI_USB_MIDI_JACK_H_ | 6 #define MEDIA_MIDI_USB_MIDI_JACK_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include <stdint.h> |
| 9 |
| 9 #include "media/midi/usb_midi_export.h" | 10 #include "media/midi/usb_midi_export.h" |
| 10 | 11 |
| 11 namespace media { | 12 namespace media { |
| 12 namespace midi { | 13 namespace midi { |
| 13 | 14 |
| 14 class UsbMidiDevice; | 15 class UsbMidiDevice; |
| 15 | 16 |
| 16 // UsbMidiJack represents an EMBEDDED MIDI jack. | 17 // UsbMidiJack represents an EMBEDDED MIDI jack. |
| 17 struct USB_MIDI_EXPORT UsbMidiJack { | 18 struct USB_MIDI_EXPORT UsbMidiJack { |
| 18 // The direction of the endpoint associated with an EMBEDDED MIDI jack. | 19 // The direction of the endpoint associated with an EMBEDDED MIDI jack. |
| 19 // Note that an IN MIDI jack associated with an OUT endpoint has | 20 // Note that an IN MIDI jack associated with an OUT endpoint has |
| 20 // ***DIRECTION_OUT*** direction. | 21 // ***DIRECTION_OUT*** direction. |
| 21 enum Direction { | 22 enum Direction { |
| 22 DIRECTION_IN, | 23 DIRECTION_IN, |
| 23 DIRECTION_OUT, | 24 DIRECTION_OUT, |
| 24 }; | 25 }; |
| 25 UsbMidiJack(UsbMidiDevice* device, | 26 UsbMidiJack(UsbMidiDevice* device, |
| 26 uint8 jack_id, | 27 uint8_t jack_id, |
| 27 uint8 cable_number, | 28 uint8_t cable_number, |
| 28 uint8 endpoint_address) | 29 uint8_t endpoint_address) |
| 29 : device(device), | 30 : device(device), |
| 30 jack_id(jack_id), | 31 jack_id(jack_id), |
| 31 cable_number(cable_number), | 32 cable_number(cable_number), |
| 32 endpoint_address(endpoint_address) {} | 33 endpoint_address(endpoint_address) {} |
| 33 // Not owned | 34 // Not owned |
| 34 UsbMidiDevice* device; | 35 UsbMidiDevice* device; |
| 35 // The id of this jack unique in the interface. | 36 // The id of this jack unique in the interface. |
| 36 uint8 jack_id; | 37 uint8_t jack_id; |
| 37 // The cable number of this jack in the associated endpoint. | 38 // The cable number of this jack in the associated endpoint. |
| 38 uint8 cable_number; | 39 uint8_t cable_number; |
| 39 // The address of the endpoint that this jack is associated with. | 40 // The address of the endpoint that this jack is associated with. |
| 40 uint8 endpoint_address; | 41 uint8_t endpoint_address; |
| 41 | 42 |
| 42 Direction direction() const { | 43 Direction direction() const { |
| 43 return (endpoint_address & 0x80) ? DIRECTION_IN : DIRECTION_OUT; | 44 return (endpoint_address & 0x80) ? DIRECTION_IN : DIRECTION_OUT; |
| 44 } | 45 } |
| 45 uint8 endpoint_number() const { | 46 uint8_t endpoint_number() const { return (endpoint_address & 0xf); } |
| 46 return (endpoint_address & 0xf); | |
| 47 } | |
| 48 }; | 47 }; |
| 49 | 48 |
| 50 } // namespace midi | 49 } // namespace midi |
| 51 } // namespace media | 50 } // namespace media |
| 52 | 51 |
| 53 #endif // MEDIA_MIDI_USB_MIDI_JACK_H_ | 52 #endif // MEDIA_MIDI_USB_MIDI_JACK_H_ |
| OLD | NEW |