| 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/midi_manager_usb.h" | 5 #include "media/midi/midi_manager_usb.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "media/midi/midi_scheduler.h" | 10 #include "media/midi/midi_scheduler.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 130 |
| 131 std::string manufacturer(device->GetManufacturer()); | 131 std::string manufacturer(device->GetManufacturer()); |
| 132 std::string product_name(device->GetProductName()); | 132 std::string product_name(device->GetProductName()); |
| 133 std::string version(device->GetDeviceVersion()); | 133 std::string version(device->GetDeviceVersion()); |
| 134 | 134 |
| 135 for (size_t j = 0; j < jacks.size(); ++j) { | 135 for (size_t j = 0; j < jacks.size(); ++j) { |
| 136 // Port ID must be unique in a MIDI manager. This ID setting is | 136 // Port ID must be unique in a MIDI manager. This ID setting is |
| 137 // sufficiently unique although there is no user-friendly meaning. | 137 // sufficiently unique although there is no user-friendly meaning. |
| 138 // TODO(yhirano): Use a hashed string as ID. | 138 // TODO(yhirano): Use a hashed string as ID. |
| 139 std::string id( | 139 std::string id( |
| 140 base::StringPrintf("port-%d-%ld", device_id, static_cast<long>(j))); | 140 base::StringPrintf("usb:port-%d-%ld", device_id, static_cast<long>(j))); |
| 141 if (jacks[j].direction() == UsbMidiJack::DIRECTION_OUT) { | 141 if (jacks[j].direction() == UsbMidiJack::DIRECTION_OUT) { |
| 142 output_streams_.push_back(new UsbMidiOutputStream(jacks[j])); | 142 output_streams_.push_back(new UsbMidiOutputStream(jacks[j])); |
| 143 AddOutputPort(MidiPortInfo(id, manufacturer, product_name, version, | 143 AddOutputPort(MidiPortInfo(id, manufacturer, product_name, version, |
| 144 MIDI_PORT_OPENED)); | 144 MIDI_PORT_OPENED)); |
| 145 } else { | 145 } else { |
| 146 DCHECK_EQ(jacks[j].direction(), UsbMidiJack::DIRECTION_IN); | 146 DCHECK_EQ(jacks[j].direction(), UsbMidiJack::DIRECTION_IN); |
| 147 input_stream_->Add(jacks[j]); | 147 input_stream_->Add(jacks[j]); |
| 148 AddInputPort(MidiPortInfo(id, manufacturer, product_name, version, | 148 AddInputPort(MidiPortInfo(id, manufacturer, product_name, version, |
| 149 MIDI_PORT_OPENED)); | 149 MIDI_PORT_OPENED)); |
| 150 } | 150 } |
| 151 } | 151 } |
| 152 return true; | 152 return true; |
| 153 } | 153 } |
| 154 | 154 |
| 155 } // namespace midi | 155 } // namespace midi |
| 156 } // namespace media | 156 } // namespace media |
| OLD | NEW |