Index: Source/modules/webmidi/MIDIAccess.cpp |
diff --git a/Source/modules/webmidi/MIDIAccess.cpp b/Source/modules/webmidi/MIDIAccess.cpp |
index 04b563d35778659d28ad6a5de5e14d9febd7eeb0..3779e91e07c73fa702e0567909d6bb295f6f688b 100644 |
--- a/Source/modules/webmidi/MIDIAccess.cpp |
+++ b/Source/modules/webmidi/MIDIAccess.cpp |
@@ -54,7 +54,42 @@ MIDIAccess::~MIDIAccess() |
MIDIAccess::MIDIAccess(ScriptExecutionContext* context) |
: ActiveDOMObject(context) |
{ |
- ScriptWrappable::init(this); |
+ // !!!!!!! Just for testing |
+ RefPtr<MIDIInput> input = MIDIInput::create(context, "id", "manufacturer", "name", "version"); |
+ m_inputs.append(input); |
+ |
+ m_midiAccessor = MIDIAccessor::create(this); |
+ |
+ // For now just ask for basic access. |
+ // FIXME: use dictionary information to determine the value here. |
+ m_midiAccessor->requestAccess(0); |
+} |
+ |
+void MIDIAccess::receiveMIDIData(unsigned portIndex, const unsigned char* data, size_t length, double timeStamp) |
+{ |
+ // FIXME: for now ignore portIndex and always use port 0 -- see "Just for testing" above. |
+ // printf("ignoring port: %d\n", portIndex); |
+ portIndex = 0; |
+ |
+ if (portIndex < m_inputs.size()) |
+ m_inputs[portIndex]->receiveMIDIData(portIndex, data, length, timeStamp); |
+} |
+ |
+void MIDIAccess::addInputPort(const String& id, const String& manufacturer, const String& name, const String& version) |
+{ |
+ RefPtr<MIDIInput> input = MIDIInput::create(scriptExecutionContext(), id, manufacturer, name, version); |
+ m_inputs.append(input); |
+} |
+ |
+void MIDIAccess::addOutputPort(const String& id, const String& manufacturer, const String& name, const String& version) |
+{ |
+ RefPtr<MIDIOutput> output = MIDIOutput::create(scriptExecutionContext(), id, manufacturer, name, version); |
+ m_outputs.append(output); |
+} |
+ |
+void MIDIAccess::accessApproved(bool approved) |
+{ |
+ // FIXME: call callbacks. |
} |
} // namespace WebCore |