| 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 } | 246 } |
| 247 | 247 |
| 248 void CrasAudioHandler::RemoveAllActiveNodes() { | 248 void CrasAudioHandler::RemoveAllActiveNodes() { |
| 249 for (AudioDeviceMap::const_iterator it = audio_devices_.begin(); | 249 for (AudioDeviceMap::const_iterator it = audio_devices_.begin(); |
| 250 it != audio_devices_.end(); | 250 it != audio_devices_.end(); |
| 251 ++it) { | 251 ++it) { |
| 252 RemoveActiveNodeInternal(it->second.id); | 252 RemoveActiveNodeInternal(it->second.id); |
| 253 } | 253 } |
| 254 } | 254 } |
| 255 | 255 |
| 256 void CrasAudioHandler::SwapInternalSpeakerLeftRightChannel(bool swap) { |
| 257 for (AudioDeviceMap::const_iterator it = audio_devices_.begin(); |
| 258 it != audio_devices_.end(); |
| 259 ++it) { |
| 260 const AudioDevice& device = it->second; |
| 261 if (!device.is_input && device.type == AUDIO_TYPE_INTERNAL_SPEAKER) { |
| 262 chromeos::DBusThreadManager::Get()->GetCrasAudioClient()->SwapLeftRight( |
| 263 device.id, swap); |
| 264 break; |
| 265 } |
| 266 } |
| 267 } |
| 268 |
| 256 bool CrasAudioHandler::has_alternative_input() const { | 269 bool CrasAudioHandler::has_alternative_input() const { |
| 257 return has_alternative_input_; | 270 return has_alternative_input_; |
| 258 } | 271 } |
| 259 | 272 |
| 260 bool CrasAudioHandler::has_alternative_output() const { | 273 bool CrasAudioHandler::has_alternative_output() const { |
| 261 return has_alternative_output_; | 274 return has_alternative_output_; |
| 262 } | 275 } |
| 263 | 276 |
| 264 void CrasAudioHandler::SetOutputVolumePercent(int volume_percent) { | 277 void CrasAudioHandler::SetOutputVolumePercent(int volume_percent) { |
| 265 // Set all active devices to the same volume. | 278 // Set all active devices to the same volume. |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 845 if (node_id == active_output_node_id_) | 858 if (node_id == active_output_node_id_) |
| 846 active_output_node_id_ = 0; | 859 active_output_node_id_ = 0; |
| 847 chromeos::DBusThreadManager::Get() | 860 chromeos::DBusThreadManager::Get() |
| 848 ->GetCrasAudioClient() | 861 ->GetCrasAudioClient() |
| 849 ->RemoveActiveOutputNode(node_id); | 862 ->RemoveActiveOutputNode(node_id); |
| 850 } | 863 } |
| 851 FOR_EACH_OBSERVER(AudioObserver, observers_, OnActiveOutputNodeChanged()); | 864 FOR_EACH_OBSERVER(AudioObserver, observers_, OnActiveOutputNodeChanged()); |
| 852 } | 865 } |
| 853 | 866 |
| 854 } // namespace chromeos | 867 } // namespace chromeos |
| OLD | NEW |