| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 MIDIOutput::MIDIOutput(MIDIAccess* access, unsigned portIndex, const String& id,
const String& manufacturer, const String& name, const String& version) | 182 MIDIOutput::MIDIOutput(MIDIAccess* access, unsigned portIndex, const String& id,
const String& manufacturer, const String& name, const String& version) |
| 183 : MIDIPort(access, id, manufacturer, name, MIDIPortTypeOutput, version) | 183 : MIDIPort(access, id, manufacturer, name, MIDIPortTypeOutput, version) |
| 184 , m_portIndex(portIndex) | 184 , m_portIndex(portIndex) |
| 185 { | 185 { |
| 186 } | 186 } |
| 187 | 187 |
| 188 MIDIOutput::~MIDIOutput() | 188 MIDIOutput::~MIDIOutput() |
| 189 { | 189 { |
| 190 } | 190 } |
| 191 | 191 |
| 192 void MIDIOutput::send(DOMUint8Array* array, double timestamp, ExceptionState& ex
ceptionState) |
| 193 { |
| 194 if (!array) |
| 195 return; |
| 196 |
| 197 send(array->view(), timestamp, exceptionState); |
| 198 } |
| 199 |
| 192 void MIDIOutput::send(Uint8Array* array, double timestamp, ExceptionState& excep
tionState) | 200 void MIDIOutput::send(Uint8Array* array, double timestamp, ExceptionState& excep
tionState) |
| 193 { | 201 { |
| 194 if (timestamp == 0.0) | 202 if (timestamp == 0.0) |
| 195 timestamp = now(executionContext()); | 203 timestamp = now(executionContext()); |
| 196 | 204 |
| 197 if (!array) | 205 if (!array) |
| 198 return; | 206 return; |
| 199 | 207 |
| 200 if (MessageValidator::validate(array, exceptionState, midiAccess()->sysexEna
bled())) | 208 if (MessageValidator::validate(array, exceptionState, midiAccess()->sysexEna
bled())) |
| 201 midiAccess()->sendMIDIData(m_portIndex, array->data(), array->length(),
timestamp); | 209 midiAccess()->sendMIDIData(m_portIndex, array->data(), array->length(),
timestamp); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 213 exceptionState.throwTypeError("The value at index " + String::number
(i) + " (" + String::number(unsignedData[i]) + ") is greater than 0xFF."); | 221 exceptionState.throwTypeError("The value at index " + String::number
(i) + " (" + String::number(unsignedData[i]) + ") is greater than 0xFF."); |
| 214 return; | 222 return; |
| 215 } | 223 } |
| 216 unsigned char value = unsignedData[i] & 0xff; | 224 unsigned char value = unsignedData[i] & 0xff; |
| 217 array->set(i, value); | 225 array->set(i, value); |
| 218 } | 226 } |
| 219 | 227 |
| 220 send(array.get(), timestamp, exceptionState); | 228 send(array.get(), timestamp, exceptionState); |
| 221 } | 229 } |
| 222 | 230 |
| 223 void MIDIOutput::send(Uint8Array* data, ExceptionState& exceptionState) | 231 void MIDIOutput::send(DOMUint8Array* data, ExceptionState& exceptionState) |
| 224 { | 232 { |
| 225 send(data, 0.0, exceptionState); | 233 send(data, 0.0, exceptionState); |
| 226 } | 234 } |
| 227 | 235 |
| 228 void MIDIOutput::send(Vector<unsigned> unsignedData, ExceptionState& exceptionSt
ate) | 236 void MIDIOutput::send(Vector<unsigned> unsignedData, ExceptionState& exceptionSt
ate) |
| 229 { | 237 { |
| 230 send(unsignedData, 0.0, exceptionState); | 238 send(unsignedData, 0.0, exceptionState); |
| 231 } | 239 } |
| 232 | 240 |
| 233 void MIDIOutput::trace(Visitor* visitor) | 241 void MIDIOutput::trace(Visitor* visitor) |
| 234 { | 242 { |
| 235 MIDIPort::trace(visitor); | 243 MIDIPort::trace(visitor); |
| 236 } | 244 } |
| 237 | 245 |
| 238 } // namespace blink | 246 } // namespace blink |
| OLD | NEW |