Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: media/midi/midi_manager_usb.cc

Issue 1177973003: [Web MIDI] Use Android MIDI API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/midi/midi_manager_android.cc ('k') | media/midi/midi_manager_usb_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « media/midi/midi_manager_android.cc ('k') | media/midi/midi_manager_usb_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698