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 |
(...skipping 17 matching lines...) Expand all Loading... |
28 class MEDIA_EXPORT MidiManagerClient { | 28 class MEDIA_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 // TODO(toyoshim): DisableInputPort(const MidiPortInfo& info) and | 38 // SetInputPortState() and SetOutputPortState() are called to notify a known |
39 // DisableOutputPort(const MidiPortInfo& info) should be added. | 39 // device gets disconnected, or connected again. |
40 // On DisableInputPort(), internal states, e.g. received_messages_queues in | 40 virtual void SetInputPortState(uint32 port_index, bool connected) = 0; |
41 // MidiHost, should be reset. | 41 virtual void SetOutputPortState(uint32 port_index, bool connected) = 0; |
42 | 42 |
43 // CompleteStartSession() is called when platform dependent preparation is | 43 // CompleteStartSession() is called when platform dependent preparation is |
44 // finished. | 44 // finished. |
45 virtual void CompleteStartSession(MidiResult result) = 0; | 45 virtual void CompleteStartSession(MidiResult result) = 0; |
46 | 46 |
47 // ReceiveMidiData() is called when MIDI data has been received from the | 47 // ReceiveMidiData() is called when MIDI data has been received from the |
48 // MIDI system. | 48 // MIDI system. |
49 // |port_index| represents the specific input port from input_ports(). | 49 // |port_index| represents the specific input port from input_ports(). |
50 // |data| represents a series of bytes encoding one or more MIDI messages. | 50 // |data| represents a series of bytes encoding one or more MIDI messages. |
51 // |length| is the number of bytes in |data|. | 51 // |length| is the number of bytes in |data|. |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 virtual void StartInitialization(); | 115 virtual void StartInitialization(); |
116 | 116 |
117 // Called from a platform dependent implementation of StartInitialization(). | 117 // Called from a platform dependent implementation of StartInitialization(). |
118 // It invokes CompleteInitializationInternal() on the thread that calls | 118 // It invokes CompleteInitializationInternal() on the thread that calls |
119 // StartSession() and distributes |result| to MIDIManagerClient objects in | 119 // StartSession() and distributes |result| to MIDIManagerClient objects in |
120 // |pending_clients_|. | 120 // |pending_clients_|. |
121 void CompleteInitialization(MidiResult result); | 121 void CompleteInitialization(MidiResult result); |
122 | 122 |
123 void AddInputPort(const MidiPortInfo& info); | 123 void AddInputPort(const MidiPortInfo& info); |
124 void AddOutputPort(const MidiPortInfo& info); | 124 void AddOutputPort(const MidiPortInfo& info); |
| 125 void SetInputPortState(uint32 port_index, bool connected); |
| 126 void SetOutputPortState(uint32 port_index, bool connected); |
125 | 127 |
126 // Dispatches to all clients. | 128 // Dispatches to all clients. |
127 // TODO(toyoshim): Fix the mac implementation to use | 129 // TODO(toyoshim): Fix the mac implementation to use |
128 // |ReceiveMidiData(..., base::TimeTicks)|. | 130 // |ReceiveMidiData(..., base::TimeTicks)|. |
129 void ReceiveMidiData(uint32 port_index, | 131 void ReceiveMidiData(uint32 port_index, |
130 const uint8* data, | 132 const uint8* data, |
131 size_t length, | 133 size_t length, |
132 double timestamp); | 134 double timestamp); |
133 | 135 |
134 void ReceiveMidiData(uint32 port_index, | 136 void ReceiveMidiData(uint32 port_index, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 // Protects access to |clients_|, |pending_clients_|, |initialized_|, | 175 // Protects access to |clients_|, |pending_clients_|, |initialized_|, |
174 // |result_|, |input_ports_| and |output_ports_|. | 176 // |result_|, |input_ports_| and |output_ports_|. |
175 base::Lock lock_; | 177 base::Lock lock_; |
176 | 178 |
177 DISALLOW_COPY_AND_ASSIGN(MidiManager); | 179 DISALLOW_COPY_AND_ASSIGN(MidiManager); |
178 }; | 180 }; |
179 | 181 |
180 } // namespace media | 182 } // namespace media |
181 | 183 |
182 #endif // MEDIA_MIDI_MIDI_MANAGER_H_ | 184 #endif // MEDIA_MIDI_MIDI_MANAGER_H_ |
OLD | NEW |