| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 // This happens as a result of the client having previously called | 61 // This happens as a result of the client having previously called |
| 62 // MidiManager::DispatchSendMidiData(). | 62 // MidiManager::DispatchSendMidiData(). |
| 63 virtual void AccumulateMidiBytesSent(size_t n) = 0; | 63 virtual void AccumulateMidiBytesSent(size_t n) = 0; |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 // Manages access to all MIDI hardware. | 66 // Manages access to all MIDI hardware. |
| 67 class MIDI_EXPORT MidiManager { | 67 class MIDI_EXPORT MidiManager { |
| 68 public: | 68 public: |
| 69 static const size_t kMaxPendingClientCount = 128; | 69 static const size_t kMaxPendingClientCount = 128; |
| 70 | 70 |
| 71 class CreationOptions { |
| 72 public: |
| 73 #if defined(OS_ANDROID) |
| 74 bool use_native_midi_api() const { return use_native_midi_api_; } |
| 75 void set_use_native_midi_api(bool b) { use_native_midi_api_ = b; } |
| 76 #endif // defined(OS_ANDROID) |
| 77 |
| 78 private: |
| 79 #if defined(OS_ANDROID) |
| 80 bool use_native_midi_api_ = false; |
| 81 #endif // defined(OS_ANDROID) |
| 82 }; |
| 83 |
| 71 MidiManager(); | 84 MidiManager(); |
| 72 virtual ~MidiManager(); | 85 virtual ~MidiManager(); |
| 73 | 86 |
| 74 // The constructor and the destructor will be called on the CrBrowserMain | 87 // The constructor and the destructor will be called on the CrBrowserMain |
| 75 // thread. | 88 // thread. |
| 76 static MidiManager* Create(); | 89 static MidiManager* Create(const CreationOptions&); |
| 77 | 90 |
| 78 // A client calls StartSession() to receive and send MIDI data. | 91 // A client calls StartSession() to receive and send MIDI data. |
| 79 // If the session is ready to start, the MIDI system is lazily initialized | 92 // If the session is ready to start, the MIDI system is lazily initialized |
| 80 // and the client is registered to receive MIDI data. | 93 // and the client is registered to receive MIDI data. |
| 81 // CompleteStartSession() is called with Result::OK if the session is started. | 94 // CompleteStartSession() is called with Result::OK if the session is started. |
| 82 // Otherwise CompleteStartSession() is called with proper Result code. | 95 // Otherwise CompleteStartSession() is called with proper Result code. |
| 83 // StartSession() and EndSession() can be called on the Chrome_IOThread. | 96 // StartSession() and EndSession() can be called on the Chrome_IOThread. |
| 84 // CompleteStartSession() will be invoked on the same Chrome_IOThread. | 97 // CompleteStartSession() will be invoked on the same Chrome_IOThread. |
| 85 void StartSession(MidiManagerClient* client); | 98 void StartSession(MidiManagerClient* client); |
| 86 | 99 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 // |result_|, |input_ports_| and |output_ports_|. | 194 // |result_|, |input_ports_| and |output_ports_|. |
| 182 base::Lock lock_; | 195 base::Lock lock_; |
| 183 | 196 |
| 184 DISALLOW_COPY_AND_ASSIGN(MidiManager); | 197 DISALLOW_COPY_AND_ASSIGN(MidiManager); |
| 185 }; | 198 }; |
| 186 | 199 |
| 187 } // namespace midi | 200 } // namespace midi |
| 188 } // namespace media | 201 } // namespace media |
| 189 | 202 |
| 190 #endif // MEDIA_MIDI_MIDI_MANAGER_H_ | 203 #endif // MEDIA_MIDI_MIDI_MANAGER_H_ |
| OLD | NEW |