Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1357)

Unified Diff: Source/modules/webmidi/MIDIInput.cpp

Issue 16288002: Web MIDI API (work in progress) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add accessApproved() Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/webmidi/MIDIInput.h ('k') | Source/modules/webmidi/MIDIMessageEvent.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/webmidi/MIDIInput.cpp
diff --git a/Source/modules/webmidi/MIDIInput.cpp b/Source/modules/webmidi/MIDIInput.cpp
index 606d21c3cf41cdd1a59d310897208530fa5939e7..0f9e022282e64b26e51173472e9a23ac6d49470c 100644
--- a/Source/modules/webmidi/MIDIInput.cpp
+++ b/Source/modules/webmidi/MIDIInput.cpp
@@ -30,6 +30,7 @@
#include "config.h"
#include "modules/webmidi/MIDIInput.h"
+#include "modules/webmidi/MIDIMessageEvent.h"
namespace WebCore {
@@ -44,4 +45,15 @@ MIDIInput::MIDIInput(ScriptExecutionContext* context, const String& id, const St
ScriptWrappable::init(this);
}
+void MIDIInput::receiveMIDIData(unsigned portIndex, const unsigned char* data, size_t length, double timeStamp)
+{
+ ASSERT(isMainThread());
+ // printf("MIDIInput::receiveMIDIData() : isMainThread() = %d\n", (int)isMainThread() );
+
+ RefPtr<Uint8Array> array = Uint8Array::create(length);
+ array->setRange(data, length, 0);
+
+ dispatchEvent(MIDIMessageEvent::create(timeStamp, array));
+}
+
} // namespace WebCore
« no previous file with comments | « Source/modules/webmidi/MIDIInput.h ('k') | Source/modules/webmidi/MIDIMessageEvent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698