OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/midi/midi_manager_win.h" | 5 #include "media/midi/midi_manager_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <ks.h> | 8 #include <ks.h> |
9 #include <ksmedia.h> | 9 #include <ksmedia.h> |
10 #include <mmreg.h> | 10 #include <mmreg.h> |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 void operator()(MIDIHDR* header) { | 87 void operator()(MIDIHDR* header) { |
88 if (!header) | 88 if (!header) |
89 return; | 89 return; |
90 delete[] static_cast<char*>(header->lpData); | 90 delete[] static_cast<char*>(header->lpData); |
91 header->lpData = NULL; | 91 header->lpData = NULL; |
92 header->dwBufferLength = 0; | 92 header->dwBufferLength = 0; |
93 delete header; | 93 delete header; |
94 } | 94 } |
95 }; | 95 }; |
96 | 96 |
97 typedef scoped_ptr<MIDIHDR, MIDIHDRDeleter> ScopedMIDIHDR; | 97 using ScopedMIDIHDR = std::unique_ptr<MIDIHDR, MIDIHDRDeleter>; |
98 | 98 |
99 ScopedMIDIHDR CreateMIDIHDR(size_t size) { | 99 ScopedMIDIHDR CreateMIDIHDR(size_t size) { |
100 ScopedMIDIHDR header(new MIDIHDR); | 100 ScopedMIDIHDR header(new MIDIHDR); |
101 ZeroMemory(header.get(), sizeof(*header)); | 101 ZeroMemory(header.get(), sizeof(*header)); |
102 header->lpData = new char[size]; | 102 header->lpData = new char[size]; |
103 header->dwBufferLength = static_cast<DWORD>(size); | 103 header->dwBufferLength = static_cast<DWORD>(size); |
104 return header; | 104 return header; |
105 } | 105 } |
106 | 106 |
107 void SendShortMidiMessageInternal(HMIDIOUT midi_out_handle, | 107 void SendShortMidiMessageInternal(HMIDIOUT midi_out_handle, |
(...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1186 base::TimeTicks time) { | 1186 base::TimeTicks time) { |
1187 ReceiveMidiData(port_index, &data[0], data.size(), time); | 1187 ReceiveMidiData(port_index, &data[0], data.size(), time); |
1188 } | 1188 } |
1189 | 1189 |
1190 MidiManager* MidiManager::Create() { | 1190 MidiManager* MidiManager::Create() { |
1191 return new MidiManagerWin(); | 1191 return new MidiManagerWin(); |
1192 } | 1192 } |
1193 | 1193 |
1194 } // namespace midi | 1194 } // namespace midi |
1195 } // namespace media | 1195 } // namespace media |
OLD | NEW |