| 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 #include "chromeos/audio/cras_audio_handler.h" | 5 #include "chromeos/audio/cras_audio_handler.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 } | 48 } |
| 49 | 49 |
| 50 } // namespace | 50 } // namespace |
| 51 | 51 |
| 52 CrasAudioHandler::AudioObserver::AudioObserver() { | 52 CrasAudioHandler::AudioObserver::AudioObserver() { |
| 53 } | 53 } |
| 54 | 54 |
| 55 CrasAudioHandler::AudioObserver::~AudioObserver() { | 55 CrasAudioHandler::AudioObserver::~AudioObserver() { |
| 56 } | 56 } |
| 57 | 57 |
| 58 void CrasAudioHandler::AudioObserver::OnOutputVolumeChanged() { | 58 void CrasAudioHandler::AudioObserver::OnOutputNodeVolumeChanged(uint64 node_id, |
| 59 double volume) { |
| 59 } | 60 } |
| 60 | 61 |
| 61 void CrasAudioHandler::AudioObserver::OnInputGainChanged() { | 62 void CrasAudioHandler::AudioObserver::OnInputGainChanged() { |
| 62 } | 63 } |
| 63 | 64 |
| 64 void CrasAudioHandler::AudioObserver::OnOutputMuteChanged() { | 65 void CrasAudioHandler::AudioObserver::OnOutputMuteChanged() { |
| 65 } | 66 } |
| 66 | 67 |
| 67 void CrasAudioHandler::AudioObserver::OnInputMuteChanged() { | 68 void CrasAudioHandler::AudioObserver::OnInputMuteChanged() { |
| 68 } | 69 } |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 volume_percent = min(max(volume_percent, 0), 100); | 630 volume_percent = min(max(volume_percent, 0), 100); |
| 630 if (volume_percent <= kMuteThresholdPercent) | 631 if (volume_percent <= kMuteThresholdPercent) |
| 631 volume_percent = 0; | 632 volume_percent = 0; |
| 632 if (node_id == active_output_node_id_) | 633 if (node_id == active_output_node_id_) |
| 633 output_volume_ = volume_percent; | 634 output_volume_ = volume_percent; |
| 634 | 635 |
| 635 audio_pref_handler_->SetVolumeGainValue(*device, volume_percent); | 636 audio_pref_handler_->SetVolumeGainValue(*device, volume_percent); |
| 636 | 637 |
| 637 if (device->active) { | 638 if (device->active) { |
| 638 SetOutputNodeVolume(node_id, volume_percent); | 639 SetOutputNodeVolume(node_id, volume_percent); |
| 639 FOR_EACH_OBSERVER(AudioObserver, observers_, OnOutputVolumeChanged()); | 640 FOR_EACH_OBSERVER(AudioObserver, observers_, |
| 641 OnOutputNodeVolumeChanged(node_id, volume_percent)); |
| 640 } | 642 } |
| 641 } | 643 } |
| 642 | 644 |
| 643 bool CrasAudioHandler::SetOutputMuteInternal(bool mute_on) { | 645 bool CrasAudioHandler::SetOutputMuteInternal(bool mute_on) { |
| 644 if (output_mute_locked_) | 646 if (output_mute_locked_) |
| 645 return false; | 647 return false; |
| 646 | 648 |
| 647 output_mute_on_ = mute_on; | 649 output_mute_on_ = mute_on; |
| 648 chromeos::DBusThreadManager::Get()->GetCrasAudioClient()-> | 650 chromeos::DBusThreadManager::Get()->GetCrasAudioClient()-> |
| 649 SetOutputUserMute(mute_on); | 651 SetOutputUserMute(mute_on); |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 959 active_output_node_id_ = 0; | 961 active_output_node_id_ = 0; |
| 960 chromeos::DBusThreadManager::Get() | 962 chromeos::DBusThreadManager::Get() |
| 961 ->GetCrasAudioClient() | 963 ->GetCrasAudioClient() |
| 962 ->RemoveActiveOutputNode(node_id); | 964 ->RemoveActiveOutputNode(node_id); |
| 963 if (notify) | 965 if (notify) |
| 964 NotifyActiveNodeChanged(false); | 966 NotifyActiveNodeChanged(false); |
| 965 } | 967 } |
| 966 } | 968 } |
| 967 | 969 |
| 968 } // namespace chromeos | 970 } // namespace chromeos |
| OLD | NEW |