| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_alsa.h" | 5 #include "media/midi/midi_manager_alsa.h" |
| 6 | 6 |
| 7 #include <alsa/asoundlib.h> | 7 #include <alsa/asoundlib.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 } | 63 } |
| 64 | 64 |
| 65 } // namespace | 65 } // namespace |
| 66 | 66 |
| 67 MidiManagerAlsa::MidiManagerAlsa() | 67 MidiManagerAlsa::MidiManagerAlsa() |
| 68 : in_client_(NULL), | 68 : in_client_(NULL), |
| 69 out_client_(NULL), | 69 out_client_(NULL), |
| 70 out_client_id_(-1), | 70 out_client_id_(-1), |
| 71 in_port_id_(-1), | 71 in_port_id_(-1), |
| 72 decoder_(NULL), | 72 decoder_(NULL), |
| 73 udev_(device::udev_new()), |
| 73 send_thread_("MidiSendThread"), | 74 send_thread_("MidiSendThread"), |
| 74 event_thread_("MidiEventThread"), | 75 event_thread_("MidiEventThread"), |
| 75 event_thread_shutdown_(false) { | 76 event_thread_shutdown_(false) { |
| 76 // Initialize decoder. | 77 // Initialize decoder. |
| 77 snd_midi_event_new(0, &decoder_); | 78 snd_midi_event_new(0, &decoder_); |
| 78 snd_midi_event_no_status(decoder_, 1); | 79 snd_midi_event_no_status(decoder_, 1); |
| 79 } | 80 } |
| 80 | 81 |
| 81 MidiManagerAlsa::~MidiManagerAlsa() { | 82 MidiManagerAlsa::~MidiManagerAlsa() { |
| 82 // Tell the event thread it will soon be time to shut down. This gives | 83 // Tell the event thread it will soon be time to shut down. This gives |
| (...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 // Update our map. | 1010 // Update our map. |
| 1010 source_map_[AddrToInt(client_id, port_id)] = port_index; | 1011 source_map_[AddrToInt(client_id, port_id)] = port_index; |
| 1011 return true; | 1012 return true; |
| 1012 } | 1013 } |
| 1013 | 1014 |
| 1014 MidiManager* MidiManager::Create() { | 1015 MidiManager* MidiManager::Create() { |
| 1015 return new MidiManagerAlsa(); | 1016 return new MidiManagerAlsa(); |
| 1016 } | 1017 } |
| 1017 | 1018 |
| 1018 } // namespace media | 1019 } // namespace media |
| OLD | NEW |