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

Unified Diff: media/midi/midi_manager_mac.h

Issue 16025005: Web MIDI API back-end (work-in-progress) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 7 years, 7 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
Index: media/midi/midi_manager_mac.h
diff --git a/media/midi/midi_manager_mac.h b/media/midi/midi_manager_mac.h
new file mode 100644
index 0000000000000000000000000000000000000000..25e65ddf79f136ddddddacf5bf33c8ddec805387
--- /dev/null
+++ b/media/midi/midi_manager_mac.h
@@ -0,0 +1,57 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_MIDI_MIDI_MANAGER_MAC_H_
+#define MEDIA_MIDI_MIDI_MANAGER_MAC_H_
+
+#include <CoreMIDI/MIDIServices.h>
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "media/midi/midi_manager.h"
+#include <map>
+
+namespace media {
+
+class MEDIA_EXPORT MIDIManagerMac : public MIDIManager {
+ public:
+ MIDIManagerMac();
+ virtual ~MIDIManagerMac();
+
+ virtual void SendMIDI(UInt8 *midi_data,
+ UInt32 length,
+ MIDITimeStamp timestamp);
+
+ private:
+ static void ReadMidiDispatch(const MIDIPacketList *pktlist,
scherkus (not reviewing) 2013/06/03 22:44:59 may want to mention from apple docs that these pro
+ void *read_proc_refcon,
+ void *src_conn_refcon);
+ virtual void ReadMidi(MIDIEndpointRef source, const MIDIPacketList *pktlist);
+
+ // Helper
+ static double MIDITimeStampToSeconds(MIDITimeStamp timestamp);
+ static MIDITimeStamp SecondsToMIDITimeStamp(double seconds);
+ CFStringRef GetDeviceNameFromEndpoint(MIDIEndpointRef endpoint);
+
+ // CoreMIDI
+ MIDIClientRef midi_client_;
+ MIDIPortRef input_port_;
+ MIDIPortRef output_port_;
+ MIDIEndpointRef destination_;
+
+ enum{ kMaxPacketListSize = 512 };
+ char mMIDIBuffer[kMaxPacketListSize];
+ MIDIPacketList* packet_list_;
+ MIDIPacket* midi_packet_;
+
+ typedef std::map<MIDIEndpointRef, int> SourceMap;
+ SourceMap source_map_;
+
+ DISALLOW_COPY_AND_ASSIGN(MIDIManagerMac);
+};
+
+} // namespace media
+
+#endif // MEDIA_MIDI_MIDI_MANAGER_MAC_H_

Powered by Google App Engine
This is Rietveld 408576698