Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Side by Side Diff: media/midi/midi_manager.h

Issue 16025005: Web MIDI API back-end (work-in-progress) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_MIDI_MIDI_MANAGER_H_
6 #define MEDIA_MIDI_MIDI_MANAGER_H_
7
8 #include "base/basictypes.h"
9 #include "base/synchronization/lock.h"
10 #include "media/base/media_export.h"
11 #include <set>
12
13 namespace media {
14
15 // Manages access to all MIDI hardware.
16 class MEDIA_EXPORT MIDIManager {
17 public:
18 static MIDIManager* Create();
19
20 MIDIManager();
21 virtual ~MIDIManager();
22
23 class Client {
24 public:
25 virtual ~Client() {}
26 virtual void ReceiveMIDIData(
27 int port_index,
28 const uint8* data,
29 size_t length,
30 double time_stamp) = 0;
31 };
32
33 void AddClient(Client* client);
34 void RemoveClient(Client* client);
35
36 protected:
37 // Dispatches to all clients.
38 void ReceiveMIDIData(
39 int port_index,
40 const uint8* data,
41 size_t length,
42 double time_stamp);
43
44 // Keeps track of all clients who wish to receive MIDI data.
45 typedef std::set<Client*> ClientList;
46 ClientList clients_;
47
48 // Protects access to our clients.
49 base::Lock clients_lock_;
50
51 DISALLOW_COPY_AND_ASSIGN(MIDIManager);
52 };
53
54 } // namespace media
55
56 #endif // MEDIA_MIDI_MIDI_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698