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 19 matching lines...) Expand all Loading... |
30 | 30 |
31 #include "modules/webmidi/MIDIAccessor.h" | 31 #include "modules/webmidi/MIDIAccessor.h" |
32 | 32 |
33 #include "modules/webmidi/MIDIAccessorClient.h" | 33 #include "modules/webmidi/MIDIAccessorClient.h" |
34 #include "public/platform/Platform.h" | 34 #include "public/platform/Platform.h" |
35 #include "wtf/PtrUtil.h" | 35 #include "wtf/PtrUtil.h" |
36 #include "wtf/text/WTFString.h" | 36 #include "wtf/text/WTFString.h" |
37 #include <memory> | 37 #include <memory> |
38 | 38 |
39 using blink::WebString; | 39 using blink::WebString; |
| 40 using midi::mojom::PortState; |
40 using midi::mojom::Result; | 41 using midi::mojom::Result; |
41 | 42 |
42 namespace blink { | 43 namespace blink { |
43 | 44 |
44 // Factory method | 45 // Factory method |
45 std::unique_ptr<MIDIAccessor> MIDIAccessor::create(MIDIAccessorClient* client) { | 46 std::unique_ptr<MIDIAccessor> MIDIAccessor::create(MIDIAccessorClient* client) { |
46 return wrapUnique(new MIDIAccessor(client)); | 47 return wrapUnique(new MIDIAccessor(client)); |
47 } | 48 } |
48 | 49 |
49 MIDIAccessor::MIDIAccessor(MIDIAccessorClient* client) : m_client(client) { | 50 MIDIAccessor::MIDIAccessor(MIDIAccessorClient* client) : m_client(client) { |
(...skipping 12 matching lines...) Expand all Loading... |
62 const unsigned char* data, | 63 const unsigned char* data, |
63 size_t length, | 64 size_t length, |
64 double timeStamp) { | 65 double timeStamp) { |
65 m_accessor->sendMIDIData(portIndex, data, length, timeStamp); | 66 m_accessor->sendMIDIData(portIndex, data, length, timeStamp); |
66 } | 67 } |
67 | 68 |
68 void MIDIAccessor::didAddInputPort(const WebString& id, | 69 void MIDIAccessor::didAddInputPort(const WebString& id, |
69 const WebString& manufacturer, | 70 const WebString& manufacturer, |
70 const WebString& name, | 71 const WebString& name, |
71 const WebString& version, | 72 const WebString& version, |
72 MIDIPortState state) { | 73 PortState state) { |
73 m_client->didAddInputPort(id, manufacturer, name, version, state); | 74 m_client->didAddInputPort(id, manufacturer, name, version, state); |
74 } | 75 } |
75 | 76 |
76 void MIDIAccessor::didAddOutputPort(const WebString& id, | 77 void MIDIAccessor::didAddOutputPort(const WebString& id, |
77 const WebString& manufacturer, | 78 const WebString& manufacturer, |
78 const WebString& name, | 79 const WebString& name, |
79 const WebString& version, | 80 const WebString& version, |
80 MIDIPortState state) { | 81 PortState state) { |
81 m_client->didAddOutputPort(id, manufacturer, name, version, state); | 82 m_client->didAddOutputPort(id, manufacturer, name, version, state); |
82 } | 83 } |
83 | 84 |
84 void MIDIAccessor::didSetInputPortState(unsigned portIndex, | 85 void MIDIAccessor::didSetInputPortState(unsigned portIndex, PortState state) { |
85 MIDIPortState state) { | |
86 m_client->didSetInputPortState(portIndex, state); | 86 m_client->didSetInputPortState(portIndex, state); |
87 } | 87 } |
88 | 88 |
89 void MIDIAccessor::didSetOutputPortState(unsigned portIndex, | 89 void MIDIAccessor::didSetOutputPortState(unsigned portIndex, PortState state) { |
90 MIDIPortState state) { | |
91 m_client->didSetOutputPortState(portIndex, state); | 90 m_client->didSetOutputPortState(portIndex, state); |
92 } | 91 } |
93 | 92 |
94 void MIDIAccessor::didStartSession(Result result) { | 93 void MIDIAccessor::didStartSession(Result result) { |
95 m_client->didStartSession(result); | 94 m_client->didStartSession(result); |
96 } | 95 } |
97 | 96 |
98 void MIDIAccessor::didReceiveMIDIData(unsigned portIndex, | 97 void MIDIAccessor::didReceiveMIDIData(unsigned portIndex, |
99 const unsigned char* data, | 98 const unsigned char* data, |
100 size_t length, | 99 size_t length, |
101 double timeStamp) { | 100 double timeStamp) { |
102 m_client->didReceiveMIDIData(portIndex, data, length, timeStamp); | 101 m_client->didReceiveMIDIData(portIndex, data, length, timeStamp); |
103 } | 102 } |
104 | 103 |
105 } // namespace blink | 104 } // namespace blink |
OLD | NEW |