Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MEDIA_MIDI_USB_MIDI_JACK_H_ | |
| 6 #define MEDIA_MIDI_USB_MIDI_JACK_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "media/base/media_export.h" | |
| 10 | |
| 11 namespace media { | |
| 12 | |
| 13 class UsbMidiDevice; | |
| 14 | |
| 15 // UsbMidiJack represents an EMBEDDED MIDI jack. | |
| 16 struct MEDIA_EXPORT UsbMidiJack { | |
|
DaleCurtis
2014/01/10 01:55:57
Class? If you think other classes will use your J
yhirano
2014/01/10 02:30:32
A jack is fully identified with (device, endpoint_
| |
| 17 // The direction of the endpoint associated with an EMBEDDED MIDI jack. | |
| 18 // Note that an IN MIDI jack associated with an OUT endpoint has | |
| 19 // ***OUT*** direction. | |
| 20 enum Direction { | |
| 21 IN, | |
| 22 OUT, | |
| 23 }; | |
| 24 UsbMidiJack(UsbMidiDevice* device, | |
| 25 uint8 jack_id, | |
| 26 uint8 cable_number, | |
| 27 uint8 endpoint_address) | |
| 28 : device(device), | |
| 29 jack_id(jack_id), | |
| 30 cable_number(cable_number), | |
| 31 endpoint_address(endpoint_address) {} | |
| 32 // Not owned | |
| 33 UsbMidiDevice* device; | |
| 34 // The id of this jack unique in the interface. | |
| 35 uint8 jack_id; | |
| 36 // The cable number of this jack in the associated endpoint. | |
| 37 uint8 cable_number; | |
| 38 // The address of the endpoint that this jack is associated with. | |
| 39 uint8 endpoint_address; | |
| 40 | |
| 41 Direction direction() const { | |
| 42 return (endpoint_address & 0x80) ? IN : OUT; | |
| 43 } | |
| 44 uint8 endpoint_number() const { | |
| 45 return (endpoint_address & 0xf); | |
| 46 } | |
| 47 }; | |
| 48 | |
| 49 } // namespace media | |
| 50 | |
| 51 #endif // MEDIA_MIDI_USB_MIDI_JACK_H_ | |
| OLD | NEW |