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 CHROMEOS_DBUS_CRAS_AUDIO_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_CRAS_AUDIO_CLIENT_H_ |
6 #define CHROMEOS_DBUS_CRAS_AUDIO_CLIENT_H_ | 6 #define CHROMEOS_DBUS_CRAS_AUDIO_CLIENT_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
10 #include "chromeos/chromeos_export.h" | 10 #include "chromeos/chromeos_export.h" |
11 #include "chromeos/dbus/audio_node.h" | 11 #include "chromeos/dbus/audio_node.h" |
12 #include "chromeos/dbus/dbus_client_implementation_type.h" | 12 #include "chromeos/dbus/dbus_client_implementation_type.h" |
13 #include "chromeos/dbus/volume_state.h" | 13 #include "chromeos/dbus/volume_state.h" |
14 | 14 |
15 namespace dbus { | 15 namespace dbus { |
16 class Bus; | 16 class Bus; |
17 } // namespace | 17 } // namespace |
18 | 18 |
19 namespace chromeos { | 19 namespace chromeos { |
20 | 20 |
21 // CrasAudioClient is used to communicate with the cras audio dbus interface. | 21 // CrasAudioClient is used to communicate with the cras audio dbus interface. |
22 class CHROMEOS_EXPORT CrasAudioClient { | 22 class CHROMEOS_EXPORT CrasAudioClient { |
23 public: | 23 public: |
24 // Interface for observing changes from the cras audio changes. | 24 // Interface for observing changes from the cras audio changes. |
25 class Observer { | 25 class Observer { |
26 public: | 26 public: |
27 // Called when audio output device volume changed. | 27 // Called when cras audio client starts or re-starts, which happens when |
| 28 // cros device powers up or restarted. |
| 29 virtual void AudioClientRestarted(); |
| 30 |
| 31 // Called when audio output device volume changed to new value of |volume|. |
28 virtual void OutputVolumeChanged(int volume); | 32 virtual void OutputVolumeChanged(int volume); |
| 33 |
| 34 // Called whne audio output mute state changed to new state of |mute_on|. |
29 virtual void OutputMuteChanged(bool mute_on); | 35 virtual void OutputMuteChanged(bool mute_on); |
| 36 |
| 37 // Called when audio input gain changeg to new value of |gain|. |
30 virtual void InputGainChanged(int gain); | 38 virtual void InputGainChanged(int gain); |
| 39 |
| 40 // Called when audio input mute state changed to new state of |mute_on|. |
31 virtual void InputMuteChanged(bool mute_on); | 41 virtual void InputMuteChanged(bool mute_on); |
| 42 |
| 43 // Called when audio nodes change. |
32 virtual void NodesChanged(); | 44 virtual void NodesChanged(); |
| 45 |
| 46 // Called when active audio output node changed to new node with |node_id|. |
33 virtual void ActiveOutputNodeChanged(uint64 node_id); | 47 virtual void ActiveOutputNodeChanged(uint64 node_id); |
| 48 |
| 49 // Called when active audio input node changed to new node with |node_id|. |
34 virtual void ActiveInputNodeChanged(uint64 node_id); | 50 virtual void ActiveInputNodeChanged(uint64 node_id); |
35 | 51 |
36 protected: | 52 protected: |
37 virtual ~Observer(); | 53 virtual ~Observer(); |
38 }; | 54 }; |
39 | 55 |
40 virtual ~CrasAudioClient(); | 56 virtual ~CrasAudioClient(); |
41 | 57 |
42 // Adds and removes the observer. | 58 // Adds and removes the observer. |
43 virtual void AddObserver(Observer* observer) = 0; | 59 virtual void AddObserver(Observer* observer) = 0; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 CrasAudioClient(); | 105 CrasAudioClient(); |
90 | 106 |
91 private: | 107 private: |
92 | 108 |
93 DISALLOW_COPY_AND_ASSIGN(CrasAudioClient); | 109 DISALLOW_COPY_AND_ASSIGN(CrasAudioClient); |
94 }; | 110 }; |
95 | 111 |
96 } // namespace chromeos | 112 } // namespace chromeos |
97 | 113 |
98 #endif // CHROMEOS_DBUS_CRAS_AUDIO_CLIENT_H_ | 114 #endif // CHROMEOS_DBUS_CRAS_AUDIO_CLIENT_H_ |
OLD | NEW |