| 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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 destructor_started = true; | 438 destructor_started = true; |
| 439 base::SystemMonitor::Get()->RemoveDevicesChangedObserver(this); | 439 base::SystemMonitor::Get()->RemoveDevicesChangedObserver(this); |
| 440 { | 440 { |
| 441 std::vector<HMIDIIN> input_devices; | 441 std::vector<HMIDIIN> input_devices; |
| 442 { | 442 { |
| 443 base::AutoLock auto_lock(input_ports_lock_); | 443 base::AutoLock auto_lock(input_ports_lock_); |
| 444 for (auto it : input_device_map_) | 444 for (auto it : input_device_map_) |
| 445 input_devices.push_back(it.first); | 445 input_devices.push_back(it.first); |
| 446 } | 446 } |
| 447 { | 447 { |
| 448 for (const auto handle : input_devices) { | 448 for (auto* handle : input_devices) { |
| 449 MMRESULT result = midiInClose(handle); | 449 MMRESULT result = midiInClose(handle); |
| 450 if (result == MIDIERR_STILLPLAYING) { | 450 if (result == MIDIERR_STILLPLAYING) { |
| 451 result = midiInReset(handle); | 451 result = midiInReset(handle); |
| 452 DLOG_IF(ERROR, result != MMSYSERR_NOERROR) | 452 DLOG_IF(ERROR, result != MMSYSERR_NOERROR) |
| 453 << "midiInReset failed: " << GetInErrorMessage(result); | 453 << "midiInReset failed: " << GetInErrorMessage(result); |
| 454 result = midiInClose(handle); | 454 result = midiInClose(handle); |
| 455 } | 455 } |
| 456 DLOG_IF(ERROR, result != MMSYSERR_NOERROR) | 456 DLOG_IF(ERROR, result != MMSYSERR_NOERROR) |
| 457 << "midiInClose failed: " << GetInErrorMessage(result); | 457 << "midiInClose failed: " << GetInErrorMessage(result); |
| 458 } | 458 } |
| 459 } | 459 } |
| 460 } | 460 } |
| 461 { | 461 { |
| 462 std::vector<HMIDIOUT> output_devices; | 462 std::vector<HMIDIOUT> output_devices; |
| 463 { | 463 { |
| 464 base::AutoLock auto_lock(output_ports_lock_); | 464 base::AutoLock auto_lock(output_ports_lock_); |
| 465 for (auto it : output_device_map_) | 465 for (auto it : output_device_map_) |
| 466 output_devices.push_back(it.first); | 466 output_devices.push_back(it.first); |
| 467 } | 467 } |
| 468 { | 468 { |
| 469 for (const auto handle : output_devices) { | 469 for (auto* handle : output_devices) { |
| 470 MMRESULT result = midiOutClose(handle); | 470 MMRESULT result = midiOutClose(handle); |
| 471 if (result == MIDIERR_STILLPLAYING) { | 471 if (result == MIDIERR_STILLPLAYING) { |
| 472 result = midiOutReset(handle); | 472 result = midiOutReset(handle); |
| 473 DLOG_IF(ERROR, result != MMSYSERR_NOERROR) | 473 DLOG_IF(ERROR, result != MMSYSERR_NOERROR) |
| 474 << "midiOutReset failed: " << GetOutErrorMessage(result); | 474 << "midiOutReset failed: " << GetOutErrorMessage(result); |
| 475 result = midiOutClose(handle); | 475 result = midiOutClose(handle); |
| 476 } | 476 } |
| 477 DLOG_IF(ERROR, result != MMSYSERR_NOERROR) | 477 DLOG_IF(ERROR, result != MMSYSERR_NOERROR) |
| 478 << "midiOutClose failed: " << GetOutErrorMessage(result); | 478 << "midiOutClose failed: " << GetOutErrorMessage(result); |
| 479 } | 479 } |
| (...skipping 706 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 |