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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <queue> | 10 #include <queue> |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
148 // This call can be invoked from I/O thread or UI thread because | 148 // This call can be invoked from I/O thread or UI thread because |
149 // it does not need to access CrasAudioClient on DBus. | 149 // it does not need to access CrasAudioClient on DBus. |
150 virtual void GetAudioDevices(AudioDeviceList* device_list) const; | 150 virtual void GetAudioDevices(AudioDeviceList* device_list) const; |
151 | 151 |
152 virtual bool GetPrimaryActiveOutputDevice(AudioDevice* device) const; | 152 virtual bool GetPrimaryActiveOutputDevice(AudioDevice* device) const; |
153 | 153 |
154 // Whether there is alternative input/output audio device. | 154 // Whether there is alternative input/output audio device. |
155 virtual bool has_alternative_input() const; | 155 virtual bool has_alternative_input() const; |
156 virtual bool has_alternative_output() const; | 156 virtual bool has_alternative_output() const; |
157 | 157 |
158 // Sets all active output devices' volume level to |volume_percent|, whose | 158 // Sets all active output devices' volume levels to |volume_percent|, whose |
159 // range is from 0-100%. | 159 // range is from 0-100%. |
160 virtual void SetOutputVolumePercent(int volume_percent); | 160 virtual void SetOutputVolumePercent(int volume_percent); |
161 | 161 |
162 // Sets all active output devices' volume levels to |volume_percent|, whose | |
163 // range is from 0-100%, without notifying observers. | |
164 virtual void SetOutputVolumePercentWithoutNotifyingObservers( | |
165 int volume_percent); | |
166 | |
162 // Sets all active input devices' gain level to |gain_percent|, whose range is | 167 // Sets all active input devices' gain level to |gain_percent|, whose range is |
163 // from 0-100%. | 168 // from 0-100%. |
164 virtual void SetInputGainPercent(int gain_percent); | 169 virtual void SetInputGainPercent(int gain_percent); |
165 | 170 |
166 // Adjusts all active output devices' volume up (positive percentage) or down | 171 // Adjusts all active output devices' volume up (positive percentage) or down |
167 // (negative percentage). | 172 // (negative percentage). |
168 virtual void AdjustOutputVolumeByPercent(int adjust_by_percent); | 173 virtual void AdjustOutputVolumeByPercent(int adjust_by_percent); |
169 | 174 |
170 // Adjusts all active output devices' volume to a minimum audible level if it | 175 // Adjusts all active output devices' volume to a minimum audible level if it |
171 // is too low. | 176 // is too low. |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
425 // Failures are not logged at startup, since CRAS may not be running yet. | 430 // Failures are not logged at startup, since CRAS may not be running yet. |
426 bool log_errors_; | 431 bool log_errors_; |
427 | 432 |
428 // Timer for HDMI re-discovering grace period. | 433 // Timer for HDMI re-discovering grace period. |
429 base::OneShotTimer hdmi_rediscover_timer_; | 434 base::OneShotTimer hdmi_rediscover_timer_; |
430 int hdmi_rediscover_grace_period_duration_in_ms_; | 435 int hdmi_rediscover_grace_period_duration_in_ms_; |
431 bool hdmi_rediscovering_; | 436 bool hdmi_rediscovering_; |
432 | 437 |
433 bool cras_service_available_ = false; | 438 bool cras_service_available_ = false; |
434 | 439 |
435 bool initializing_audio_state_ = false; | 440 // A mask with non-zero value indicates it is an automated volume changed. |
441 // It can be set on AutomatedVolumeChangeReason bits. | |
442 // VOLUME_CHANGE_INITIALIZING_AUDIO_STATE indicates it is from intializaing | |
443 // audio state. | |
444 // VOLUME_CHANGE_MAXIMIZE_MODE_SCREENSHOT indicates it is from restoring | |
445 // volume in maximimize mode screenshot. | |
446 int automated_volume_change_ = 0; | |
447 | |
436 int init_volume_; | 448 int init_volume_; |
437 uint64_t init_node_id_; | 449 uint64_t init_node_id_; |
438 int init_volume_count_ = 0; | 450 int init_volume_count_ = 0; |
439 | 451 |
452 int maximize_mode_screenshot_count_ = 0; | |
Daniel Erat
2016/07/29 22:27:30
keeping a bitmap and a counter in parallel seems a
Qiang(Joe) Xu
2016/08/01 20:28:09
done. thanks!
| |
453 | |
440 base::WeakPtrFactory<CrasAudioHandler> weak_ptr_factory_; | 454 base::WeakPtrFactory<CrasAudioHandler> weak_ptr_factory_; |
441 | 455 |
442 DISALLOW_COPY_AND_ASSIGN(CrasAudioHandler); | 456 DISALLOW_COPY_AND_ASSIGN(CrasAudioHandler); |
443 }; | 457 }; |
444 | 458 |
445 } // namespace chromeos | 459 } // namespace chromeos |
446 | 460 |
447 #endif // CHROMEOS_AUDIO_CRAS_AUDIO_HANDLER_H_ | 461 #endif // CHROMEOS_AUDIO_CRAS_AUDIO_HANDLER_H_ |
OLD | NEW |