| 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_alsa.h" | 5 #include "media/midi/midi_manager_alsa.h" |
| 6 | 6 |
| 7 #include <alsa/asoundlib.h> | 7 #include <alsa/asoundlib.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 scoped_ptr<MidiPort> port) { | 439 scoped_ptr<MidiPort> port) { |
| 440 ports()->push_back(port.Pass()); | 440 ports()->push_back(port.Pass()); |
| 441 } | 441 } |
| 442 | 442 |
| 443 MidiManagerAlsa::MidiPortState::MidiPortState() | 443 MidiManagerAlsa::MidiPortState::MidiPortState() |
| 444 : num_input_ports_(0), num_output_ports_(0) { | 444 : num_input_ports_(0), num_output_ports_(0) { |
| 445 } | 445 } |
| 446 | 446 |
| 447 uint32 MidiManagerAlsa::MidiPortState::Insert(scoped_ptr<MidiPort> port) { | 447 uint32 MidiManagerAlsa::MidiPortState::Insert(scoped_ptr<MidiPort> port) { |
| 448 // Add the web midi index. | 448 // Add the web midi index. |
| 449 uint32 web_port_index; | 449 uint32 web_port_index = 0; |
| 450 switch (port->type()) { | 450 switch (port->type()) { |
| 451 case MidiPort::Type::kInput: | 451 case MidiPort::Type::kInput: |
| 452 web_port_index = num_input_ports_++; | 452 web_port_index = num_input_ports_++; |
| 453 break; | 453 break; |
| 454 case MidiPort::Type::kOutput: | 454 case MidiPort::Type::kOutput: |
| 455 web_port_index = num_output_ports_++; | 455 web_port_index = num_output_ports_++; |
| 456 break; | 456 break; |
| 457 } | 457 } |
| 458 port->set_web_port_index(web_port_index); | 458 port->set_web_port_index(web_port_index); |
| 459 ports()->push_back(port.Pass()); | 459 ports()->push_back(port.Pass()); |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 // Update our map. | 1009 // Update our map. |
| 1010 source_map_[AddrToInt(client_id, port_id)] = port_index; | 1010 source_map_[AddrToInt(client_id, port_id)] = port_index; |
| 1011 return true; | 1011 return true; |
| 1012 } | 1012 } |
| 1013 | 1013 |
| 1014 MidiManager* MidiManager::Create() { | 1014 MidiManager* MidiManager::Create() { |
| 1015 return new MidiManagerAlsa(); | 1015 return new MidiManagerAlsa(); |
| 1016 } | 1016 } |
| 1017 | 1017 |
| 1018 } // namespace media | 1018 } // namespace media |
| OLD | NEW |