1 // Copyright 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.
5 #ifndef MEDIA_MIDI_MIDI_MANAGER_WIN_H_
6 #define MEDIA_MIDI_MIDI_MANAGER_WIN_H_
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/threading/thread.h"
13 #include "base/time/time.h"
14 #include "media/midi/midi_manager.h"
19 class MidiServiceWinDelegate
{
21 virtual ~MidiServiceWinDelegate() {}
22 virtual void OnCompleteInitialization(Result result
) = 0;
23 virtual void OnAddInputPort(MidiPortInfo info
) = 0;
24 virtual void OnAddOutputPort(MidiPortInfo info
) = 0;
25 virtual void OnSetInputPortState(uint32 port_index
, MidiPortState state
) = 0;
26 virtual void OnSetOutputPortState(uint32 port_index
, MidiPortState state
) = 0;
27 virtual void OnReceiveMidiData(uint32 port_index
,
28 const std::vector
<uint8
>& data
,
29 base::TimeTicks time
) = 0;
32 class MidiServiceWin
{
34 virtual ~MidiServiceWin() {}
35 // This method may return before the initialization is completed.
36 virtual void InitializeAsync(MidiServiceWinDelegate
* delegate
) = 0;
37 // This method may return before the specified data is actually sent.
38 virtual void SendMidiDataAsync(uint32 port_number
,
39 const std::vector
<uint8
>& data
,
40 base::TimeTicks time
) = 0;
43 class MidiManagerWin final
: public MidiManager
, public MidiServiceWinDelegate
{
46 ~MidiManagerWin() override
;
48 // MidiManager overrides:
49 void StartInitialization() final
;
50 void DispatchSendMidiData(MidiManagerClient
* client
,
52 const std::vector
<uint8
>& data
,
53 double timestamp
) final
;
55 // MidiServiceWinDelegate overrides:
56 void OnCompleteInitialization(Result result
) final
;
57 void OnAddInputPort(MidiPortInfo info
) final
;
58 void OnAddOutputPort(MidiPortInfo info
) final
;
59 void OnSetInputPortState(uint32 port_index
, MidiPortState state
) final
;
60 void OnSetOutputPortState(uint32 port_index
, MidiPortState state
) final
;
61 void OnReceiveMidiData(uint32 port_index
,
62 const std::vector
<uint8
>& data
,
63 base::TimeTicks time
) final
;
66 scoped_ptr
<MidiServiceWin
> midi_service_
;
67 DISALLOW_COPY_AND_ASSIGN(MidiManagerWin
);
73 #endif // MEDIA_MIDI_MIDI_MANAGER_WIN_H_