OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #ifndef MEDIA_MIDI_MIDI_MANAGER_H_ | 5 #ifndef MEDIA_MIDI_MIDI_MANAGER_H_ |
6 #define MEDIA_MIDI_MIDI_MANAGER_H_ | 6 #define MEDIA_MIDI_MIDI_MANAGER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "media/base/media_export.h" | 15 #include "media/midi/midi_export.h" |
16 #include "media/midi/midi_port_info.h" | 16 #include "media/midi/midi_port_info.h" |
17 #include "media/midi/midi_result.h" | 17 #include "media/midi/midi_result.h" |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 class SingleThreadTaskRunner; | 20 class SingleThreadTaskRunner; |
21 } // namespace base | 21 } // namespace base |
22 | 22 |
23 namespace media { | 23 namespace media { |
24 | 24 |
25 // A MidiManagerClient registers with the MidiManager to receive MIDI data. | 25 // A MidiManagerClient registers with the MidiManager to receive MIDI data. |
26 // See MidiManager::RequestAccess() and MidiManager::ReleaseAccess() | 26 // See MidiManager::RequestAccess() and MidiManager::ReleaseAccess() |
27 // for details. | 27 // for details. |
28 class MEDIA_EXPORT MidiManagerClient { | 28 class MIDI_EXPORT MidiManagerClient { |
29 public: | 29 public: |
30 virtual ~MidiManagerClient() {} | 30 virtual ~MidiManagerClient() {} |
31 | 31 |
32 // AddInputPort() and AddOutputPort() are called before CompleteStartSession() | 32 // AddInputPort() and AddOutputPort() are called before CompleteStartSession() |
33 // is called to notify existing MIDI ports, and also called after that to | 33 // is called to notify existing MIDI ports, and also called after that to |
34 // notify new MIDI ports are added. | 34 // notify new MIDI ports are added. |
35 virtual void AddInputPort(const MidiPortInfo& info) = 0; | 35 virtual void AddInputPort(const MidiPortInfo& info) = 0; |
36 virtual void AddOutputPort(const MidiPortInfo& info) = 0; | 36 virtual void AddOutputPort(const MidiPortInfo& info) = 0; |
37 | 37 |
38 // SetInputPortState() and SetOutputPortState() are called to notify a known | 38 // SetInputPortState() and SetOutputPortState() are called to notify a known |
(...skipping 17 matching lines...) Expand all Loading... |
56 double timestamp) = 0; | 56 double timestamp) = 0; |
57 | 57 |
58 // AccumulateMidiBytesSent() is called to acknowledge when bytes have | 58 // AccumulateMidiBytesSent() is called to acknowledge when bytes have |
59 // successfully been sent to the hardware. | 59 // successfully been sent to the hardware. |
60 // This happens as a result of the client having previously called | 60 // This happens as a result of the client having previously called |
61 // MidiManager::DispatchSendMidiData(). | 61 // MidiManager::DispatchSendMidiData(). |
62 virtual void AccumulateMidiBytesSent(size_t n) = 0; | 62 virtual void AccumulateMidiBytesSent(size_t n) = 0; |
63 }; | 63 }; |
64 | 64 |
65 // Manages access to all MIDI hardware. | 65 // Manages access to all MIDI hardware. |
66 class MEDIA_EXPORT MidiManager { | 66 class MIDI_EXPORT MidiManager { |
67 public: | 67 public: |
68 static const size_t kMaxPendingClientCount = 128; | 68 static const size_t kMaxPendingClientCount = 128; |
69 | 69 |
70 MidiManager(); | 70 MidiManager(); |
71 virtual ~MidiManager(); | 71 virtual ~MidiManager(); |
72 | 72 |
73 // The constructor and the destructor will be called on the CrBrowserMain | 73 // The constructor and the destructor will be called on the CrBrowserMain |
74 // thread. | 74 // thread. |
75 static MidiManager* Create(); | 75 static MidiManager* Create(); |
76 | 76 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 // Protects access to |clients_|, |pending_clients_|, |initialized_|, | 179 // Protects access to |clients_|, |pending_clients_|, |initialized_|, |
180 // |result_|, |input_ports_| and |output_ports_|. | 180 // |result_|, |input_ports_| and |output_ports_|. |
181 base::Lock lock_; | 181 base::Lock lock_; |
182 | 182 |
183 DISALLOW_COPY_AND_ASSIGN(MidiManager); | 183 DISALLOW_COPY_AND_ASSIGN(MidiManager); |
184 }; | 184 }; |
185 | 185 |
186 } // namespace media | 186 } // namespace media |
187 | 187 |
188 #endif // MEDIA_MIDI_MIDI_MANAGER_H_ | 188 #endif // MEDIA_MIDI_MIDI_MANAGER_H_ |
OLD | NEW |