OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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.h" | 5 #include "media/midi/midi_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 client->AddInputPort(info); | 123 client->AddInputPort(info); |
124 } | 124 } |
125 | 125 |
126 void MidiManager::AddOutputPort(const MidiPortInfo& info) { | 126 void MidiManager::AddOutputPort(const MidiPortInfo& info) { |
127 base::AutoLock auto_lock(lock_); | 127 base::AutoLock auto_lock(lock_); |
128 output_ports_.push_back(info); | 128 output_ports_.push_back(info); |
129 for (auto client : clients_) | 129 for (auto client : clients_) |
130 client->AddOutputPort(info); | 130 client->AddOutputPort(info); |
131 } | 131 } |
132 | 132 |
| 133 void MidiManager::SetInputPortState(uint32 port_index, MidiPortState state) { |
| 134 base::AutoLock auto_lock(lock_); |
| 135 DCHECK_LT(port_index, input_ports_.size()); |
| 136 input_ports_[port_index].state = state; |
| 137 for (auto client : clients_) |
| 138 client->SetInputPortState(port_index, state); |
| 139 } |
| 140 |
| 141 void MidiManager::SetOutputPortState(uint32 port_index, MidiPortState state) { |
| 142 base::AutoLock auto_lock(lock_); |
| 143 DCHECK_LT(port_index, output_ports_.size()); |
| 144 output_ports_[port_index].state = state; |
| 145 for (auto client : clients_) |
| 146 client->SetOutputPortState(port_index, state); |
| 147 } |
| 148 |
133 void MidiManager::ReceiveMidiData( | 149 void MidiManager::ReceiveMidiData( |
134 uint32 port_index, | 150 uint32 port_index, |
135 const uint8* data, | 151 const uint8* data, |
136 size_t length, | 152 size_t length, |
137 double timestamp) { | 153 double timestamp) { |
138 base::AutoLock auto_lock(lock_); | 154 base::AutoLock auto_lock(lock_); |
139 | 155 |
140 for (auto client : clients_) | 156 for (auto client : clients_) |
141 client->ReceiveMidiData(port_index, data, length, timestamp); | 157 client->ReceiveMidiData(port_index, data, length, timestamp); |
142 } | 158 } |
(...skipping 20 matching lines...) Expand all Loading... |
163 void MidiManager::AddInitialPorts(MidiManagerClient* client) { | 179 void MidiManager::AddInitialPorts(MidiManagerClient* client) { |
164 lock_.AssertAcquired(); | 180 lock_.AssertAcquired(); |
165 | 181 |
166 for (const auto& info : input_ports_) | 182 for (const auto& info : input_ports_) |
167 client->AddInputPort(info); | 183 client->AddInputPort(info); |
168 for (const auto& info : output_ports_) | 184 for (const auto& info : output_ports_) |
169 client->AddOutputPort(info); | 185 client->AddOutputPort(info); |
170 } | 186 } |
171 | 187 |
172 } // namespace media | 188 } // namespace media |
OLD | NEW |