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_ |