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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 MIDIInput::MIDIInput(MIDIAccess* access, const String& id, const String& manufac
turer, const String& name, const String& version, PortState state) | 50 MIDIInput::MIDIInput(MIDIAccess* access, const String& id, const String& manufac
turer, const String& name, const String& version, PortState state) |
51 : MIDIPort(access, id, manufacturer, name, TypeInput, version, state) | 51 : MIDIPort(access, id, manufacturer, name, TypeInput, version, state) |
52 { | 52 { |
53 } | 53 } |
54 | 54 |
55 EventListener* MIDIInput::onmidimessage() | 55 EventListener* MIDIInput::onmidimessage() |
56 { | 56 { |
57 return getAttributeEventListener(EventTypeNames::midimessage); | 57 return getAttributeEventListener(EventTypeNames::midimessage); |
58 } | 58 } |
59 | 59 |
60 void MIDIInput::setOnmidimessage(PassRefPtr<EventListener> listener) | 60 void MIDIInput::setOnmidimessage(PassRefPtrWillBeRawPtr<EventListener> listener) |
61 { | 61 { |
62 // Implicit open. It does nothing if the port is already opened. | 62 // Implicit open. It does nothing if the port is already opened. |
63 // See http://www.w3.org/TR/webmidi/#widl-MIDIPort-open-Promise-MIDIPort | 63 // See http://www.w3.org/TR/webmidi/#widl-MIDIPort-open-Promise-MIDIPort |
64 open(); | 64 open(); |
65 | 65 |
66 setAttributeEventListener(EventTypeNames::midimessage, listener); | 66 setAttributeEventListener(EventTypeNames::midimessage, listener); |
67 } | 67 } |
68 | 68 |
69 void MIDIInput::didReceiveMIDIData(unsigned portIndex, const unsigned char* data
, size_t length, double timeStamp) | 69 void MIDIInput::didReceiveMIDIData(unsigned portIndex, const unsigned char* data
, size_t length, double timeStamp) |
70 { | 70 { |
(...skipping 13 matching lines...) Expand all Loading... |
84 RefPtr<DOMUint8Array> array = DOMUint8Array::create(data, length); | 84 RefPtr<DOMUint8Array> array = DOMUint8Array::create(data, length); |
85 dispatchEvent(MIDIMessageEvent::create(timeStamp, array)); | 85 dispatchEvent(MIDIMessageEvent::create(timeStamp, array)); |
86 } | 86 } |
87 | 87 |
88 DEFINE_TRACE(MIDIInput) | 88 DEFINE_TRACE(MIDIInput) |
89 { | 89 { |
90 MIDIPort::trace(visitor); | 90 MIDIPort::trace(visitor); |
91 } | 91 } |
92 | 92 |
93 } // namespace blink | 93 } // namespace blink |
OLD | NEW |