| Index: trunk/src/chromeos/audio/cras_audio_handler.cc
|
| ===================================================================
|
| --- trunk/src/chromeos/audio/cras_audio_handler.cc (revision 198567)
|
| +++ trunk/src/chromeos/audio/cras_audio_handler.cc (working copy)
|
| @@ -11,7 +11,6 @@
|
| #include "base/bind_helpers.h"
|
| #include "base/logging.h"
|
| #include "chromeos/audio/audio_devices_pref_handler.h"
|
| -#include "chromeos/audio/cras_audio_switch_handler.h"
|
| #include "chromeos/audio/mock_cras_audio_handler.h"
|
| #include "chromeos/dbus/dbus_thread_manager.h"
|
|
|
| @@ -42,9 +41,6 @@
|
| void CrasAudioHandler::AudioObserver::OnOutputVolumeChanged() {
|
| }
|
|
|
| -void CrasAudioHandler::AudioObserver::OnInputGainChanged() {
|
| -}
|
| -
|
| void CrasAudioHandler::AudioObserver::OnOutputMuteChanged() {
|
| }
|
|
|
| @@ -112,24 +108,6 @@
|
| return output_volume_;
|
| }
|
|
|
| -int CrasAudioHandler::GetOutputVolumePercentForDevice(uint64 device_id) {
|
| - if (device_id == active_output_node_id_)
|
| - return output_volume_;
|
| - else
|
| - return (int) audio_pref_handler_->GetVolumeGainValue(device_id);
|
| -}
|
| -
|
| -int CrasAudioHandler::GetInputGainPercent() {
|
| - return input_gain_;
|
| -}
|
| -
|
| -int CrasAudioHandler::GetInputGainPercentForDevice(uint64 device_id) {
|
| - if (device_id == active_input_node_id_)
|
| - return input_gain_;
|
| - else
|
| - return (int) audio_pref_handler_->GetVolumeGainValue(device_id);
|
| -}
|
| -
|
| uint64 CrasAudioHandler::GetActiveOutputNode() const {
|
| return active_output_node_id_;
|
| }
|
| @@ -172,17 +150,6 @@
|
| SetOutputMute(true);
|
| }
|
|
|
| -void CrasAudioHandler::SetInputGainPercent(int gain_percent) {
|
| - gain_percent = min(max(gain_percent, 0), 100);
|
| - if (gain_percent <= kMuteThresholdPercent)
|
| - gain_percent = 0;
|
| - SetInputGainInternal(gain_percent);
|
| - if (IsInputMuted() && gain_percent > 0)
|
| - SetInputMute(false);
|
| - if (!IsInputMuted() && gain_percent == 0)
|
| - SetInputMute(true);
|
| -}
|
| -
|
| void CrasAudioHandler::AdjustOutputVolumeByPercent(int adjust_by_percent) {
|
| SetOutputVolumePercent(output_volume_ + adjust_by_percent);
|
| }
|
| @@ -221,23 +188,6 @@
|
| SetActiveInputNode(node_id);
|
| }
|
|
|
| -void CrasAudioHandler::SetVolumeGainPercentForDevice(uint64 device_id,
|
| - int value) {
|
| - if (device_id == active_output_node_id_) {
|
| - SetOutputVolumePercent(value);
|
| - return;
|
| - } else if (device_id == active_input_node_id_) {
|
| - SetInputGainPercent(value);
|
| - return;
|
| - }
|
| -
|
| - value = min(max(value, 0), 100);
|
| - if (value <= kMuteThresholdPercent)
|
| - value = 0;
|
| -
|
| - audio_pref_handler_->SetVolumeGainValue(device_id, value);
|
| -}
|
| -
|
| CrasAudioHandler::CrasAudioHandler(
|
| scoped_refptr<AudioDevicesPrefHandler> audio_pref_handler)
|
| : audio_pref_handler_(audio_pref_handler),
|
| @@ -245,7 +195,6 @@
|
| output_mute_on_(false),
|
| input_mute_on_(false),
|
| output_volume_(0),
|
| - input_gain_(0),
|
| active_output_node_id_(0),
|
| active_input_node_id_(0),
|
| has_alternative_input_(false),
|
| @@ -286,27 +235,16 @@
|
| return;
|
|
|
| output_volume_ = volume;
|
| - audio_pref_handler_->SetVolumeGainValue(active_output_node_id_,
|
| - output_volume_);
|
| + audio_pref_handler_->SetOutputVolumeValue(output_volume_);
|
| FOR_EACH_OBSERVER(AudioObserver, observers_, OnOutputVolumeChanged());
|
| }
|
|
|
| -void CrasAudioHandler::InputGainChanged(int gain) {
|
| - if (input_gain_ == gain)
|
| - return;
|
| -
|
| - input_gain_ = gain;
|
| - audio_pref_handler_->SetVolumeGainValue(active_input_node_id_, input_gain_);
|
| - FOR_EACH_OBSERVER(AudioObserver, observers_, OnInputGainChanged());
|
| -}
|
| -
|
| void CrasAudioHandler::OutputMuteChanged(bool mute_on) {
|
| if (output_mute_on_ == mute_on)
|
| return;
|
|
|
| output_mute_on_ = mute_on;
|
| - audio_pref_handler_->SetMuteValue(active_output_node_id_,
|
| - mute_on);
|
| + audio_pref_handler_->SetOutputMuteValue(mute_on);
|
| FOR_EACH_OBSERVER(AudioObserver, observers_, OnOutputMuteChanged());
|
| }
|
|
|
| @@ -315,8 +253,6 @@
|
| return;
|
|
|
| input_mute_on_ = mute_on;
|
| - audio_pref_handler_->SetMuteValue(active_input_node_id_,
|
| - mute_on);
|
| FOR_EACH_OBSERVER(AudioObserver, observers_, OnInputMuteChanged());
|
| }
|
|
|
| @@ -339,7 +275,6 @@
|
| return;
|
|
|
| active_input_node_id_ = node_id;
|
| - SetupAudioState();
|
| FOR_EACH_OBSERVER(AudioObserver, observers_, OnActiveInputNodeChanged());
|
| }
|
|
|
| @@ -351,30 +286,10 @@
|
| ApplyAudioPolicy();
|
|
|
| // Set the initial audio state to the ones read from audio prefs.
|
| - if (active_input_node_id_) {
|
| - input_mute_on_ = audio_pref_handler_->GetMuteValue(active_input_node_id_);
|
| - input_gain_ = audio_pref_handler_->GetVolumeGainValue(
|
| - active_input_node_id_);
|
| - SetInputMute(input_mute_on_);
|
| - SetInputGainInternal(input_gain_);
|
| - } else {
|
| - SetInputMute(kPrefMuteOff);
|
| - SetInputGainInternal(kDefaultVolumeGainPercent);
|
| - }
|
| -
|
| - if (active_output_node_id_) {
|
| - output_mute_on_ = audio_pref_handler_->GetMuteValue(active_output_node_id_);
|
| - output_volume_ = audio_pref_handler_->GetVolumeGainValue(
|
| - active_output_node_id_);
|
| - SetOutputMute(output_mute_on_);
|
| - SetOutputVolumeInternal(output_volume_);
|
| - } else {
|
| - SetOutputMute(kPrefMuteOff);
|
| - SetOutputVolumeInternal(kDefaultVolumeGainPercent);
|
| - }
|
| -
|
| - if (!active_output_node_id_ || !active_input_node_id_)
|
| - CrasAudioSwitchHandler::Get()->UpdateActiveDevice();
|
| + output_mute_on_ = audio_pref_handler_->GetOutputMuteValue();
|
| + output_volume_ = audio_pref_handler_->GetOutputVolumeValue();
|
| + SetOutputVolumeInternal(output_volume_);
|
| + SetOutputMute(output_mute_on_);
|
| }
|
|
|
| void CrasAudioHandler::ApplyAudioPolicy() {
|
| @@ -398,11 +313,6 @@
|
| SetOutputVolume(volume);
|
| }
|
|
|
| -void CrasAudioHandler::SetInputGainInternal(int gain) {
|
| - chromeos::DBusThreadManager::Get()->GetCrasAudioClient()->
|
| - SetInputGain(gain);
|
| -}
|
| -
|
| void CrasAudioHandler::GetNodes() {
|
| chromeos::DBusThreadManager::Get()->GetCrasAudioClient()->GetNodes(
|
| base::Bind(&CrasAudioHandler::HandleGetNodes,
|
|
|