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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 virtual ~MidiManagerClient() {} | 33 virtual ~MidiManagerClient() {} |
34 | 34 |
35 // AddInputPort() and AddOutputPort() are called before CompleteStartSession() | 35 // AddInputPort() and AddOutputPort() are called before CompleteStartSession() |
36 // is called to notify existing MIDI ports, and also called after that to | 36 // is called to notify existing MIDI ports, and also called after that to |
37 // notify new MIDI ports are added. | 37 // notify new MIDI ports are added. |
38 virtual void AddInputPort(const MidiPortInfo& info) = 0; | 38 virtual void AddInputPort(const MidiPortInfo& info) = 0; |
39 virtual void AddOutputPort(const MidiPortInfo& info) = 0; | 39 virtual void AddOutputPort(const MidiPortInfo& info) = 0; |
40 | 40 |
41 // SetInputPortState() and SetOutputPortState() are called to notify a known | 41 // SetInputPortState() and SetOutputPortState() are called to notify a known |
42 // device gets disconnected, or connected again. | 42 // device gets disconnected, or connected again. |
43 virtual void SetInputPortState(uint32_t port_index, MidiPortState state) = 0; | 43 virtual void SetInputPortState(uint32_t port_index, |
44 virtual void SetOutputPortState(uint32_t port_index, MidiPortState state) = 0; | 44 mojom::PortState state) = 0; |
| 45 virtual void SetOutputPortState(uint32_t port_index, |
| 46 mojom::PortState state) = 0; |
45 | 47 |
46 // CompleteStartSession() is called when platform dependent preparation is | 48 // CompleteStartSession() is called when platform dependent preparation is |
47 // finished. | 49 // finished. |
48 virtual void CompleteStartSession(mojom::Result result) = 0; | 50 virtual void CompleteStartSession(mojom::Result result) = 0; |
49 | 51 |
50 // ReceiveMidiData() is called when MIDI data has been received from the | 52 // ReceiveMidiData() is called when MIDI data has been received from the |
51 // MIDI system. | 53 // MIDI system. |
52 // |port_index| represents the specific input port from input_ports(). | 54 // |port_index| represents the specific input port from input_ports(). |
53 // |data| represents a series of bytes encoding one or more MIDI messages. | 55 // |data| represents a series of bytes encoding one or more MIDI messages. |
54 // |length| is the number of bytes in |data|. | 56 // |length| is the number of bytes in |data|. |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 virtual void Finalize() {} | 140 virtual void Finalize() {} |
139 | 141 |
140 // Called from a platform dependent implementation of StartInitialization(). | 142 // Called from a platform dependent implementation of StartInitialization(). |
141 // It invokes CompleteInitializationInternal() on the thread that calls | 143 // It invokes CompleteInitializationInternal() on the thread that calls |
142 // StartSession() and distributes |result| to MIDIManagerClient objects in | 144 // StartSession() and distributes |result| to MIDIManagerClient objects in |
143 // |pending_clients_|. | 145 // |pending_clients_|. |
144 void CompleteInitialization(mojom::Result result); | 146 void CompleteInitialization(mojom::Result result); |
145 | 147 |
146 void AddInputPort(const MidiPortInfo& info); | 148 void AddInputPort(const MidiPortInfo& info); |
147 void AddOutputPort(const MidiPortInfo& info); | 149 void AddOutputPort(const MidiPortInfo& info); |
148 void SetInputPortState(uint32_t port_index, MidiPortState state); | 150 void SetInputPortState(uint32_t port_index, mojom::PortState state); |
149 void SetOutputPortState(uint32_t port_index, MidiPortState state); | 151 void SetOutputPortState(uint32_t port_index, mojom::PortState state); |
150 | 152 |
151 // Dispatches to all clients. | 153 // Dispatches to all clients. |
152 // TODO(toyoshim): Fix the mac implementation to use | 154 // TODO(toyoshim): Fix the mac implementation to use |
153 // |ReceiveMidiData(..., base::TimeTicks)|. | 155 // |ReceiveMidiData(..., base::TimeTicks)|. |
154 void ReceiveMidiData(uint32_t port_index, | 156 void ReceiveMidiData(uint32_t port_index, |
155 const uint8_t* data, | 157 const uint8_t* data, |
156 size_t length, | 158 size_t length, |
157 double timestamp); | 159 double timestamp); |
158 | 160 |
159 void ReceiveMidiData(uint32_t port_index, | 161 void ReceiveMidiData(uint32_t port_index, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 // |session_thread_runner_|, |initialized_|, |finalize_|, |result_|, | 208 // |session_thread_runner_|, |initialized_|, |finalize_|, |result_|, |
207 // |input_ports_| and |output_ports_|. | 209 // |input_ports_| and |output_ports_|. |
208 base::Lock lock_; | 210 base::Lock lock_; |
209 | 211 |
210 DISALLOW_COPY_AND_ASSIGN(MidiManager); | 212 DISALLOW_COPY_AND_ASSIGN(MidiManager); |
211 }; | 213 }; |
212 | 214 |
213 } // namespace midi | 215 } // namespace midi |
214 | 216 |
215 #endif // MEDIA_MIDI_MIDI_MANAGER_H_ | 217 #endif // MEDIA_MIDI_MIDI_MANAGER_H_ |
OLD | NEW |