| 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_AUDIO_CRAS_AUDIO_HANDLER_H_ | 5 #ifndef CHROMEOS_AUDIO_CRAS_AUDIO_HANDLER_H_ |
| 6 #define CHROMEOS_AUDIO_CRAS_AUDIO_HANDLER_H_ | 6 #define CHROMEOS_AUDIO_CRAS_AUDIO_HANDLER_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 // Returns true if audio output is muted for a device. | 99 // Returns true if audio output is muted for a device. |
| 100 virtual bool IsOutputMutedForDevice(uint64 device_id); | 100 virtual bool IsOutputMutedForDevice(uint64 device_id); |
| 101 | 101 |
| 102 // Returns true if audio input is muted. | 102 // Returns true if audio input is muted. |
| 103 virtual bool IsInputMuted(); | 103 virtual bool IsInputMuted(); |
| 104 | 104 |
| 105 // Returns true if audio input is muted for a device. | 105 // Returns true if audio input is muted for a device. |
| 106 virtual bool IsInputMutedForDevice(uint64 device_id); | 106 virtual bool IsInputMutedForDevice(uint64 device_id); |
| 107 | 107 |
| 108 // Returns true if the output volume is below the default mute volume level. |
| 109 virtual bool IsOutputVolumeBelowDefaultMuteLvel(); |
| 110 |
| 108 // Gets volume level in 0-100% range (0 being pure silence) for the current | 111 // Gets volume level in 0-100% range (0 being pure silence) for the current |
| 109 // active node. | 112 // active node. |
| 110 virtual int GetOutputVolumePercent(); | 113 virtual int GetOutputVolumePercent(); |
| 111 | 114 |
| 112 // Gets volume level in 0-100% range (0 being pure silence) for a device. | 115 // Gets volume level in 0-100% range (0 being pure silence) for a device. |
| 113 virtual int GetOutputVolumePercentForDevice(uint64 device_id); | 116 virtual int GetOutputVolumePercentForDevice(uint64 device_id); |
| 114 | 117 |
| 115 // Gets gain level in 0-100% range (0 being pure silence) for the current | 118 // Gets gain level in 0-100% range (0 being pure silence) for the current |
| 116 // active node. | 119 // active node. |
| 117 virtual int GetInputGainPercent(); | 120 virtual int GetInputGainPercent(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 138 // mutes the sound. If it was muted, and |volume_percent| is larger than | 141 // mutes the sound. If it was muted, and |volume_percent| is larger than |
| 139 // the threshold, then the sound is unmuted. | 142 // the threshold, then the sound is unmuted. |
| 140 virtual void SetOutputVolumePercent(int volume_percent); | 143 virtual void SetOutputVolumePercent(int volume_percent); |
| 141 | 144 |
| 142 // Sets gain level from 0-100%. | 145 // Sets gain level from 0-100%. |
| 143 virtual void SetInputGainPercent(int gain_percent); | 146 virtual void SetInputGainPercent(int gain_percent); |
| 144 | 147 |
| 145 // Adjusts volume up (positive percentage) or down (negative percentage). | 148 // Adjusts volume up (positive percentage) or down (negative percentage). |
| 146 virtual void AdjustOutputVolumeByPercent(int adjust_by_percent); | 149 virtual void AdjustOutputVolumeByPercent(int adjust_by_percent); |
| 147 | 150 |
| 151 // Adjusts output volume to a minimum audible level if it is too low. |
| 152 virtual void AdjustOutputVolumeToAudibleLevel(); |
| 153 |
| 148 // Mutes or unmutes audio output device. | 154 // Mutes or unmutes audio output device. |
| 149 virtual void SetOutputMute(bool mute_on); | 155 virtual void SetOutputMute(bool mute_on); |
| 150 | 156 |
| 151 // Mutes or unmutes audio input device. | 157 // Mutes or unmutes audio input device. |
| 152 virtual void SetInputMute(bool mute_on); | 158 virtual void SetInputMute(bool mute_on); |
| 153 | 159 |
| 154 // Sets the active audio output node to the node with |node_id|. | 160 // Sets the active audio output node to the node with |node_id|. |
| 155 virtual void SetActiveOutputNode(uint64 node_id); | 161 virtual void SetActiveOutputNode(uint64 node_id); |
| 156 | 162 |
| 157 // Sets the active audio input node to the node with |node_id|. | 163 // Sets the active audio input node to the node with |node_id|. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 // is created or cras audio client is restarted. | 197 // is created or cras audio client is restarted. |
| 192 void InitializeAudioState(); | 198 void InitializeAudioState(); |
| 193 | 199 |
| 194 // Applies the audio muting policies whenever the user logs in or policy | 200 // Applies the audio muting policies whenever the user logs in or policy |
| 195 // change notification is received. | 201 // change notification is received. |
| 196 void ApplyAudioPolicy(); | 202 void ApplyAudioPolicy(); |
| 197 | 203 |
| 198 // Sets output volume to specified value of |volume|. | 204 // Sets output volume to specified value of |volume|. |
| 199 void SetOutputVolumeInternal(int volume); | 205 void SetOutputVolumeInternal(int volume); |
| 200 | 206 |
| 201 // Sets output mute state to |mute_on|. | 207 // Sets output mute state to |mute_on| internally, returns true if output mute |
| 208 // is set. |
| 202 bool SetOutputMuteInternal(bool mute_on); | 209 bool SetOutputMuteInternal(bool mute_on); |
| 203 | 210 |
| 204 // Sets output volume to specified value and notifies observers. | 211 // Sets output volume to specified value and notifies observers. |
| 205 void SetInputGainInternal(int gain); | 212 void SetInputGainInternal(int gain); |
| 206 | 213 |
| 214 // Sets input mute state to |mute_on| internally, returns true if input mute |
| 215 // is set. |
| 216 bool SetInputMuteInternal(bool mute_on); |
| 217 |
| 207 // Calling dbus to get nodes data. | 218 // Calling dbus to get nodes data. |
| 208 void GetNodes(); | 219 void GetNodes(); |
| 209 | 220 |
| 210 // Updates the current audio nodes list and switches the active device | 221 // Updates the current audio nodes list and switches the active device |
| 211 // if needed. | 222 // if needed. |
| 212 void UpdateDevicesAndSwitchActive(const AudioNodeList& nodes); | 223 void UpdateDevicesAndSwitchActive(const AudioNodeList& nodes); |
| 213 | 224 |
| 214 void SwitchToDevice(const AudioDevice& device); | 225 void SwitchToDevice(const AudioDevice& device); |
| 215 | 226 |
| 216 // Handles dbus callback for GetNodes. | 227 // Handles dbus callback for GetNodes. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 237 | 248 |
| 238 bool output_mute_locked_; | 249 bool output_mute_locked_; |
| 239 bool input_mute_locked_; | 250 bool input_mute_locked_; |
| 240 | 251 |
| 241 DISALLOW_COPY_AND_ASSIGN(CrasAudioHandler); | 252 DISALLOW_COPY_AND_ASSIGN(CrasAudioHandler); |
| 242 }; | 253 }; |
| 243 | 254 |
| 244 } // namespace chromeos | 255 } // namespace chromeos |
| 245 | 256 |
| 246 #endif // CHROMEOS_AUDIO_CRAS_AUDIO_HANDLER_H_ | 257 #endif // CHROMEOS_AUDIO_CRAS_AUDIO_HANDLER_H_ |
| OLD | NEW |