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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 } | 94 } |
95 }; | 95 }; |
96 | 96 |
97 typedef scoped_ptr<MIDIHDR, MIDIHDRDeleter> ScopedMIDIHDR; | 97 typedef scoped_ptr<MIDIHDR, MIDIHDRDeleter> ScopedMIDIHDR; |
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.Pass(); | 104 return header; |
105 } | 105 } |
106 | 106 |
107 void SendShortMidiMessageInternal(HMIDIOUT midi_out_handle, | 107 void SendShortMidiMessageInternal(HMIDIOUT midi_out_handle, |
108 const std::vector<uint8_t>& message) { | 108 const std::vector<uint8_t>& message) { |
109 DCHECK_LE(message.size(), static_cast<size_t>(3)) | 109 DCHECK_LE(message.size(), static_cast<size_t>(3)) |
110 << "A short MIDI message should be up to 3 bytes."; | 110 << "A short MIDI message should be up to 3 bytes."; |
111 | 111 |
112 DWORD packed_message = 0; | 112 DWORD packed_message = 0; |
113 for (size_t i = 0; i < message.size(); ++i) | 113 for (size_t i = 0; i < message.size(); ++i) |
114 packed_message |= (static_cast<uint32_t>(message[i]) << (i * 8)); | 114 packed_message |= (static_cast<uint32_t>(message[i]) << (i * 8)); |
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1184 base::TimeTicks time) { | 1184 base::TimeTicks time) { |
1185 ReceiveMidiData(port_index, &data[0], data.size(), time); | 1185 ReceiveMidiData(port_index, &data[0], data.size(), time); |
1186 } | 1186 } |
1187 | 1187 |
1188 MidiManager* MidiManager::Create() { | 1188 MidiManager* MidiManager::Create() { |
1189 return new MidiManagerWin(); | 1189 return new MidiManagerWin(); |
1190 } | 1190 } |
1191 | 1191 |
1192 } // namespace midi | 1192 } // namespace midi |
1193 } // namespace media | 1193 } // namespace media |
OLD | NEW |