| 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 | 8 |
| 9 // Prevent unnecessary functions from being included from <mmsystem.h> | 9 // Prevent unnecessary functions from being included from <mmsystem.h> |
| 10 #define MMNODRV | 10 #define MMNODRV |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 std::string GetInErrorMessage(MMRESULT result) { | 33 std::string GetInErrorMessage(MMRESULT result) { |
| 34 wchar_t text[MAXERRORLENGTH]; | 34 wchar_t text[MAXERRORLENGTH]; |
| 35 MMRESULT get_result = midiInGetErrorText(result, text, arraysize(text)); | 35 MMRESULT get_result = midiInGetErrorText(result, text, arraysize(text)); |
| 36 if (get_result != MMSYSERR_NOERROR) { | 36 if (get_result != MMSYSERR_NOERROR) { |
| 37 DLOG(ERROR) << "Failed to get error message." | 37 DLOG(ERROR) << "Failed to get error message." |
| 38 << " original error: " << result | 38 << " original error: " << result |
| 39 << " midiInGetErrorText error: " << get_result; | 39 << " midiInGetErrorText error: " << get_result; |
| 40 return std::string(); | 40 return std::string(); |
| 41 } | 41 } |
| 42 return WideToUTF8(text); | 42 return base::WideToUTF8(text); |
| 43 } | 43 } |
| 44 | 44 |
| 45 std::string GetOutErrorMessage(MMRESULT result) { | 45 std::string GetOutErrorMessage(MMRESULT result) { |
| 46 wchar_t text[MAXERRORLENGTH]; | 46 wchar_t text[MAXERRORLENGTH]; |
| 47 MMRESULT get_result = midiOutGetErrorText(result, text, arraysize(text)); | 47 MMRESULT get_result = midiOutGetErrorText(result, text, arraysize(text)); |
| 48 if (get_result != MMSYSERR_NOERROR) { | 48 if (get_result != MMSYSERR_NOERROR) { |
| 49 DLOG(ERROR) << "Failed to get error message." | 49 DLOG(ERROR) << "Failed to get error message." |
| 50 << " original error: " << result | 50 << " original error: " << result |
| 51 << " midiOutGetErrorText error: " << get_result; | 51 << " midiOutGetErrorText error: " << get_result; |
| 52 return std::string(); | 52 return std::string(); |
| 53 } | 53 } |
| 54 return WideToUTF8(text); | 54 return base::WideToUTF8(text); |
| 55 } | 55 } |
| 56 | 56 |
| 57 class MIDIHDRDeleter { | 57 class MIDIHDRDeleter { |
| 58 public: | 58 public: |
| 59 void operator()(MIDIHDR* header) { | 59 void operator()(MIDIHDR* header) { |
| 60 if (!header) | 60 if (!header) |
| 61 return; | 61 return; |
| 62 delete[] static_cast<char*>(header->lpData); | 62 delete[] static_cast<char*>(header->lpData); |
| 63 header->lpData = NULL; | 63 header->lpData = NULL; |
| 64 header->dwBufferLength = 0; | 64 header->dwBufferLength = 0; |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 FROM_HERE, | 594 FROM_HERE, |
| 595 base::Bind(&MIDIManagerClient::AccumulateMIDIBytesSent, | 595 base::Bind(&MIDIManagerClient::AccumulateMIDIBytesSent, |
| 596 base::Unretained(client), data.size())); | 596 base::Unretained(client), data.size())); |
| 597 } | 597 } |
| 598 | 598 |
| 599 MIDIManager* MIDIManager::Create() { | 599 MIDIManager* MIDIManager::Create() { |
| 600 return new MIDIManagerWin(); | 600 return new MIDIManagerWin(); |
| 601 } | 601 } |
| 602 | 602 |
| 603 } // namespace media | 603 } // namespace media |
| OLD | NEW |