| 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/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 std::vector<UsbMidiJack> input_jacks; | 99 std::vector<UsbMidiJack> input_jacks; |
| 100 for (size_t j = 0; j < jacks.size(); ++j) { | 100 for (size_t j = 0; j < jacks.size(); ++j) { |
| 101 if (jacks[j].direction() == UsbMidiJack::DIRECTION_OUT) { | 101 if (jacks[j].direction() == UsbMidiJack::DIRECTION_OUT) { |
| 102 output_streams_.push_back(new UsbMidiOutputStream(jacks[j])); | 102 output_streams_.push_back(new UsbMidiOutputStream(jacks[j])); |
| 103 // TODO(yhirano): Set appropriate properties. | 103 // TODO(yhirano): Set appropriate properties. |
| 104 // TODO(yhiran): Port ID should contain product ID / vendor ID. | 104 // TODO(yhiran): Port ID should contain product ID / vendor ID. |
| 105 // Port ID must be unique in a MIDI manager. This (and the below) ID | 105 // Port ID must be unique in a MIDI manager. This (and the below) ID |
| 106 // setting is sufficiently unique although there is no user-friendly | 106 // setting is sufficiently unique although there is no user-friendly |
| 107 // meaning. | 107 // meaning. |
| 108 MidiPortInfo port; | 108 MidiPortInfo port; |
| 109 port.state = MIDI_PORT_OPENED; |
| 109 port.id = base::StringPrintf("port-%ld-%ld", | 110 port.id = base::StringPrintf("port-%ld-%ld", |
| 110 static_cast<long>(i), | 111 static_cast<long>(i), |
| 111 static_cast<long>(j)); | 112 static_cast<long>(j)); |
| 112 AddOutputPort(port); | 113 AddOutputPort(port); |
| 113 } else { | 114 } else { |
| 114 DCHECK_EQ(jacks[j].direction(), UsbMidiJack::DIRECTION_IN); | 115 DCHECK_EQ(jacks[j].direction(), UsbMidiJack::DIRECTION_IN); |
| 115 input_jacks.push_back(jacks[j]); | 116 input_jacks.push_back(jacks[j]); |
| 116 // TODO(yhirano): Set appropriate properties. | 117 // TODO(yhirano): Set appropriate properties. |
| 117 MidiPortInfo port; | 118 MidiPortInfo port; |
| 119 port.state = MIDI_PORT_OPENED; |
| 118 port.id = base::StringPrintf("port-%ld-%ld", | 120 port.id = base::StringPrintf("port-%ld-%ld", |
| 119 static_cast<long>(i), | 121 static_cast<long>(i), |
| 120 static_cast<long>(j)); | 122 static_cast<long>(j)); |
| 121 AddInputPort(port); | 123 AddInputPort(port); |
| 122 } | 124 } |
| 123 } | 125 } |
| 124 input_stream_.reset(new UsbMidiInputStream(input_jacks, this)); | 126 input_stream_.reset(new UsbMidiInputStream(input_jacks, this)); |
| 125 } | 127 } |
| 126 initialize_callback_.Run(MIDI_OK); | 128 initialize_callback_.Run(MIDI_OK); |
| 127 } | 129 } |
| 128 | 130 |
| 129 } // namespace media | 131 } // namespace media |
| OLD | NEW |