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> |
11 // Prevent unnecessary functions from being included from <mmsystem.h> | 11 // Prevent unnecessary functions from being included from <mmsystem.h> |
12 #define MMNODRV | 12 #define MMNODRV |
13 #define MMNOSOUND | 13 #define MMNOSOUND |
14 #define MMNOWAVE | 14 #define MMNOWAVE |
15 #define MMNOAUX | 15 #define MMNOAUX |
16 #define MMNOMIXER | 16 #define MMNOMIXER |
17 #define MMNOTIMER | 17 #define MMNOTIMER |
18 #define MMNOJOY | 18 #define MMNOJOY |
19 #define MMNOMCI | 19 #define MMNOMCI |
20 #define MMNOMMIO | 20 #define MMNOMMIO |
21 #include <mmsystem.h> | 21 #include <mmsystem.h> |
22 | 22 |
23 #include <algorithm> | 23 #include <algorithm> |
24 #include <functional> | 24 #include <functional> |
25 #include <queue> | 25 #include <queue> |
26 #include <string> | 26 #include <string> |
27 | 27 |
28 #include "base/bind.h" | 28 #include "base/bind.h" |
29 #include "base/containers/hash_tables.h" | 29 #include "base/containers/hash_tables.h" |
| 30 #include "base/macros.h" |
30 #include "base/message_loop/message_loop.h" | 31 #include "base/message_loop/message_loop.h" |
31 #include "base/strings/string16.h" | 32 #include "base/strings/string16.h" |
32 #include "base/strings/string_number_conversions.h" | 33 #include "base/strings/string_number_conversions.h" |
33 #include "base/strings/string_piece.h" | 34 #include "base/strings/string_piece.h" |
34 #include "base/strings/stringprintf.h" | 35 #include "base/strings/stringprintf.h" |
35 #include "base/strings/utf_string_conversions.h" | 36 #include "base/strings/utf_string_conversions.h" |
36 #include "base/system_monitor/system_monitor.h" | 37 #include "base/system_monitor/system_monitor.h" |
37 #include "base/threading/thread_checker.h" | 38 #include "base/threading/thread_checker.h" |
38 #include "base/timer/timer.h" | 39 #include "base/timer/timer.h" |
39 #include "base/win/message_window.h" | 40 #include "base/win/message_window.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 << GetOutErrorMessage(result); | 162 << GetOutErrorMessage(result); |
162 result = midiOutUnprepareHeader(midi_out_handle, midi_header.get(), | 163 result = midiOutUnprepareHeader(midi_out_handle, midi_header.get(), |
163 sizeof(*midi_header)); | 164 sizeof(*midi_header)); |
164 DLOG_IF(ERROR, result != MMSYSERR_NOERROR) | 165 DLOG_IF(ERROR, result != MMSYSERR_NOERROR) |
165 << "Failed to uninitialize output buffer: " | 166 << "Failed to uninitialize output buffer: " |
166 << GetOutErrorMessage(result); | 167 << GetOutErrorMessage(result); |
167 return; | 168 return; |
168 } | 169 } |
169 | 170 |
170 // The ownership of |midi_header| is moved to MOM_DONE event handler. | 171 // The ownership of |midi_header| is moved to MOM_DONE event handler. |
171 midi_header.release(); | 172 ignore_result(midi_header.release()); |
172 } | 173 } |
173 | 174 |
174 template <size_t array_size> | 175 template <size_t array_size> |
175 base::string16 AsString16(const wchar_t(&buffer)[array_size]) { | 176 base::string16 AsString16(const wchar_t(&buffer)[array_size]) { |
176 size_t len = 0; | 177 size_t len = 0; |
177 for (len = 0; len < array_size; ++len) { | 178 for (len = 0; len < array_size; ++len) { |
178 if (buffer[len] == L'\0') | 179 if (buffer[len] == L'\0') |
179 break; | 180 break; |
180 } | 181 } |
181 return base::string16(buffer, len); | 182 return base::string16(buffer, len); |
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1175 base::TimeTicks time) { | 1176 base::TimeTicks time) { |
1176 ReceiveMidiData(port_index, &data[0], data.size(), time); | 1177 ReceiveMidiData(port_index, &data[0], data.size(), time); |
1177 } | 1178 } |
1178 | 1179 |
1179 MidiManager* MidiManager::Create() { | 1180 MidiManager* MidiManager::Create() { |
1180 return new MidiManagerWin(); | 1181 return new MidiManagerWin(); |
1181 } | 1182 } |
1182 | 1183 |
1183 } // namespace midi | 1184 } // namespace midi |
1184 } // namespace media | 1185 } // namespace media |
OLD | NEW |