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 "content/browser/media/midi_host.h" | 5 #include "content/browser/media/midi_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/process/process.h" | 9 #include "base/process/process.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 base::AutoLock auto_lock(messages_queues_lock_); | 138 base::AutoLock auto_lock(messages_queues_lock_); |
139 // MidiMessageQueue is created later in ReceiveMidiData(). | 139 // MidiMessageQueue is created later in ReceiveMidiData(). |
140 received_messages_queues_.push_back(nullptr); | 140 received_messages_queues_.push_back(nullptr); |
141 Send(new MidiMsg_AddInputPort(info)); | 141 Send(new MidiMsg_AddInputPort(info)); |
142 } | 142 } |
143 | 143 |
144 void MidiHost::AddOutputPort(const media::MidiPortInfo& info) { | 144 void MidiHost::AddOutputPort(const media::MidiPortInfo& info) { |
145 Send(new MidiMsg_AddOutputPort(info)); | 145 Send(new MidiMsg_AddOutputPort(info)); |
146 } | 146 } |
147 | 147 |
| 148 void MidiHost::SetInputPortState(uint32 port, media::MidiPortState state) { |
| 149 Send(new MidiMsg_SetInputPortState(port, state)); |
| 150 } |
| 151 |
| 152 void MidiHost::SetOutputPortState(uint32 port, media::MidiPortState state) { |
| 153 Send(new MidiMsg_SetOutputPortState(port, state)); |
| 154 } |
| 155 |
148 void MidiHost::ReceiveMidiData( | 156 void MidiHost::ReceiveMidiData( |
149 uint32 port, | 157 uint32 port, |
150 const uint8* data, | 158 const uint8* data, |
151 size_t length, | 159 size_t length, |
152 double timestamp) { | 160 double timestamp) { |
153 TRACE_EVENT0("midi", "MidiHost::ReceiveMidiData"); | 161 TRACE_EVENT0("midi", "MidiHost::ReceiveMidiData"); |
154 | 162 |
155 base::AutoLock auto_lock(messages_queues_lock_); | 163 base::AutoLock auto_lock(messages_queues_lock_); |
156 if (received_messages_queues_.size() <= port) | 164 if (received_messages_queues_.size() <= port) |
157 return; | 165 return; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 } | 232 } |
225 waiting_data_length = media::GetMidiMessageLength(current); | 233 waiting_data_length = media::GetMidiMessageLength(current); |
226 if (waiting_data_length == 0) | 234 if (waiting_data_length == 0) |
227 return false; // Error: |current| should have been a valid status byte. | 235 return false; // Error: |current| should have been a valid status byte. |
228 --waiting_data_length; // Found status byte | 236 --waiting_data_length; // Found status byte |
229 } | 237 } |
230 return waiting_data_length == 0 && !in_sysex; | 238 return waiting_data_length == 0 && !in_sysex; |
231 } | 239 } |
232 | 240 |
233 } // namespace content | 241 } // namespace content |
OLD | NEW |