OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef MEDIA_MIDI_MIDI_MANAGER_MAC_H_ | |
6 #define MEDIA_MIDI_MIDI_MANAGER_MAC_H_ | |
7 | |
8 #include <CoreMIDI/MIDIServices.h> | |
9 #include <string> | |
10 | |
11 #include "base/basictypes.h" | |
12 #include "base/compiler_specific.h" | |
13 #include "media/midi/midi_manager.h" | |
14 #include <map> | |
15 | |
16 namespace media { | |
17 | |
18 class MEDIA_EXPORT MIDIManagerMac : public MIDIManager { | |
19 public: | |
20 MIDIManagerMac(); | |
21 virtual ~MIDIManagerMac(); | |
22 | |
23 virtual void SendMIDI(UInt8 *midi_data, | |
24 UInt32 length, | |
25 MIDITimeStamp timestamp); | |
26 | |
27 private: | |
28 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
| |
29 void *read_proc_refcon, | |
30 void *src_conn_refcon); | |
31 virtual void ReadMidi(MIDIEndpointRef source, const MIDIPacketList *pktl ist); | |
32 | |
33 // Helper | |
34 static double MIDITimeStampToSeconds(MIDITimeStamp timestamp); | |
35 static MIDITimeStamp SecondsToMIDITimeStamp(double seconds); | |
36 CFStringRef GetDeviceNameFromEndpoint(MIDIEndpointRef endpoint); | |
37 | |
38 // CoreMIDI | |
39 MIDIClientRef midi_client_; | |
40 MIDIPortRef input_port_; | |
41 MIDIPortRef output_port_; | |
42 MIDIEndpointRef destination_; | |
43 | |
44 enum{ kMaxPacketListSize = 512 }; | |
45 char mMIDIBuffer[kMaxPacketListSize]; | |
46 MIDIPacketList* packet_list_; | |
47 MIDIPacket* midi_packet_; | |
48 | |
49 typedef std::map<MIDIEndpointRef, int> SourceMap; | |
50 SourceMap source_map_; | |
51 | |
52 DISALLOW_COPY_AND_ASSIGN(MIDIManagerMac); | |
53 }; | |
54 | |
55 } // namespace media | |
56 | |
57 #endif // MEDIA_MIDI_MIDI_MANAGER_MAC_H_ | |
OLD | NEW |