OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 190 |
191 MIDIOutput::~MIDIOutput() | 191 MIDIOutput::~MIDIOutput() |
192 { | 192 { |
193 } | 193 } |
194 | 194 |
195 void MIDIOutput::send(DOMUint8Array* array, double timestamp, ExceptionState& ex
ceptionState) | 195 void MIDIOutput::send(DOMUint8Array* array, double timestamp, ExceptionState& ex
ceptionState) |
196 { | 196 { |
197 if (timestamp == 0.0) | 197 if (timestamp == 0.0) |
198 timestamp = now(executionContext()); | 198 timestamp = now(executionContext()); |
199 | 199 |
| 200 // Implicit open. It does nothing if the port is already opened. |
| 201 // This should be performed even if |array| is invalid. |
| 202 open(); |
| 203 |
200 if (!array) | 204 if (!array) |
201 return; | 205 return; |
202 | 206 |
203 if (MessageValidator::validate(array, exceptionState, midiAccess()->sysexEna
bled())) | 207 if (MessageValidator::validate(array, exceptionState, midiAccess()->sysexEna
bled())) |
204 midiAccess()->sendMIDIData(m_portIndex, array->data(), array->length(),
timestamp); | 208 midiAccess()->sendMIDIData(m_portIndex, array->data(), array->length(),
timestamp); |
205 } | 209 } |
206 | 210 |
207 void MIDIOutput::send(Vector<unsigned> unsignedData, double timestamp, Exception
State& exceptionState) | 211 void MIDIOutput::send(Vector<unsigned> unsignedData, double timestamp, Exception
State& exceptionState) |
208 { | 212 { |
209 if (timestamp == 0.0) | 213 if (timestamp == 0.0) |
(...skipping 24 matching lines...) Expand all Loading... |
234 { | 238 { |
235 send(unsignedData, 0.0, exceptionState); | 239 send(unsignedData, 0.0, exceptionState); |
236 } | 240 } |
237 | 241 |
238 DEFINE_TRACE(MIDIOutput) | 242 DEFINE_TRACE(MIDIOutput) |
239 { | 243 { |
240 MIDIPort::trace(visitor); | 244 MIDIPort::trace(visitor); |
241 } | 245 } |
242 | 246 |
243 } // namespace blink | 247 } // namespace blink |
OLD | NEW |