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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 manager_->ReceiveMidiData(port_index_, data, length, timestamp); | 347 manager_->ReceiveMidiData(port_index_, data, length, timestamp); |
348 } | 348 } |
349 | 349 |
350 MidiManagerWin* manager_; | 350 MidiManagerWin* manager_; |
351 int port_index_; | 351 int port_index_; |
352 HMIDIIN midi_handle_; | 352 HMIDIIN midi_handle_; |
353 ScopedMIDIHDR midi_header_; | 353 ScopedMIDIHDR midi_header_; |
354 base::TimeTicks start_time_; | 354 base::TimeTicks start_time_; |
355 bool started_; | 355 bool started_; |
356 bool device_to_be_closed_; | 356 bool device_to_be_closed_; |
357 DISALLOW_COPY_AND_ASSIGN(MidiManagerWin::InDeviceInfo); | 357 DISALLOW_COPY_AND_ASSIGN(InDeviceInfo); |
358 }; | 358 }; |
359 | 359 |
360 class MidiManagerWin::OutDeviceInfo { | 360 class MidiManagerWin::OutDeviceInfo { |
361 public: | 361 public: |
362 ~OutDeviceInfo() { | 362 ~OutDeviceInfo() { |
363 Uninitialize(); | 363 Uninitialize(); |
364 } | 364 } |
365 | 365 |
366 static scoped_ptr<OutDeviceInfo> Create(UINT device_id) { | 366 static scoped_ptr<OutDeviceInfo> Create(UINT device_id) { |
367 scoped_ptr<OutDeviceInfo> obj(new OutDeviceInfo); | 367 scoped_ptr<OutDeviceInfo> obj(new OutDeviceInfo); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 } | 487 } |
488 | 488 |
489 HMIDIOUT midi_handle_; | 489 HMIDIOUT midi_handle_; |
490 | 490 |
491 // True if the device is already closed. | 491 // True if the device is already closed. |
492 volatile bool closed_; | 492 volatile bool closed_; |
493 | 493 |
494 // True if the MidiManagerWin is trying to stop the sender thread. | 494 // True if the MidiManagerWin is trying to stop the sender thread. |
495 volatile bool quitting_; | 495 volatile bool quitting_; |
496 | 496 |
497 DISALLOW_COPY_AND_ASSIGN(MidiManagerWin::OutDeviceInfo); | 497 DISALLOW_COPY_AND_ASSIGN(OutDeviceInfo); |
498 }; | 498 }; |
499 | 499 |
500 MidiManagerWin::MidiManagerWin() | 500 MidiManagerWin::MidiManagerWin() |
501 : send_thread_("MidiSendThread") { | 501 : send_thread_("MidiSendThread") { |
502 } | 502 } |
503 | 503 |
504 bool MidiManagerWin::Initialize() { | 504 bool MidiManagerWin::Initialize() { |
505 TRACE_EVENT0("midi", "MidiManagerWin::Initialize"); | 505 TRACE_EVENT0("midi", "MidiManagerWin::Initialize"); |
506 const UINT num_in_devices = midiInGetNumDevs(); | 506 const UINT num_in_devices = midiInGetNumDevs(); |
507 in_devices_.reserve(num_in_devices); | 507 in_devices_.reserve(num_in_devices); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 FROM_HERE, | 596 FROM_HERE, |
597 base::Bind(&MidiManagerClient::AccumulateMidiBytesSent, | 597 base::Bind(&MidiManagerClient::AccumulateMidiBytesSent, |
598 base::Unretained(client), data.size())); | 598 base::Unretained(client), data.size())); |
599 } | 599 } |
600 | 600 |
601 MidiManager* MidiManager::Create() { | 601 MidiManager* MidiManager::Create() { |
602 return new MidiManagerWin(); | 602 return new MidiManagerWin(); |
603 } | 603 } |
604 | 604 |
605 } // namespace media | 605 } // namespace media |
OLD | NEW |