blob: 65cb189c23e18214f25a7c1c2002d8641bec9bf5 [file] [log] [blame]
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <stdint.h>
#include "media/midi/usb_midi_export.h"
namespace media {
namespace midi {
class UsbMidiDevice;
// UsbMidiJack represents an EMBEDDED MIDI jack.
struct USB_MIDI_EXPORT UsbMidiJack {
// The direction of the endpoint associated with an EMBEDDED MIDI jack.
// Note that an IN MIDI jack associated with an OUT endpoint has
// ***DIRECTION_OUT*** direction.
enum Direction {
UsbMidiJack(UsbMidiDevice* device,
uint8_t jack_id,
uint8_t cable_number,
uint8_t endpoint_address)
: device(device),
endpoint_address(endpoint_address) {}
// Not owned
UsbMidiDevice* device;
// The id of this jack unique in the interface.
uint8_t jack_id;
// The cable number of this jack in the associated endpoint.
uint8_t cable_number;
// The address of the endpoint that this jack is associated with.
uint8_t endpoint_address;
Direction direction() const {
return (endpoint_address & 0x80) ? DIRECTION_IN : DIRECTION_OUT;
uint8_t endpoint_number() const { return (endpoint_address & 0xf); }
} // namespace midi
} // namespace media