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::SwapLeftRight(bool swap) { | |
257 if (!active_output_node_id_) { | |
258 VLOG(1) << "SwapLeftRight: Cannot find primary active output node"; | |
259 return; | |
260 } | |
261 | |
262 chromeos::DBusThreadManager::Get()->GetCrasAudioClient()->SwapLeftRight( | |
263 active_output_node_id_, swap); | |
flackr
2014/10/01 20:32:33
We shouldn't swap the channels on any device excep
jennyz
2014/10/01 20:41:19
Cras decides if the channel swapping is supported,
jennyz
2014/10/01 20:52:11
Think again, you are right, we'd only guard to mak
jennyz
2014/10/01 21:30:33
Done.
| |
264 } | |
265 | |
256 bool CrasAudioHandler::has_alternative_input() const { | 266 bool CrasAudioHandler::has_alternative_input() const { |
257 return has_alternative_input_; | 267 return has_alternative_input_; |
258 } | 268 } |
259 | 269 |
260 bool CrasAudioHandler::has_alternative_output() const { | 270 bool CrasAudioHandler::has_alternative_output() const { |
261 return has_alternative_output_; | 271 return has_alternative_output_; |
262 } | 272 } |
263 | 273 |
264 void CrasAudioHandler::SetOutputVolumePercent(int volume_percent) { | 274 void CrasAudioHandler::SetOutputVolumePercent(int volume_percent) { |
265 // Set all active devices to the same volume. | 275 // 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_) | 855 if (node_id == active_output_node_id_) |
846 active_output_node_id_ = 0; | 856 active_output_node_id_ = 0; |
847 chromeos::DBusThreadManager::Get() | 857 chromeos::DBusThreadManager::Get() |
848 ->GetCrasAudioClient() | 858 ->GetCrasAudioClient() |
849 ->RemoveActiveOutputNode(node_id); | 859 ->RemoveActiveOutputNode(node_id); |
850 } | 860 } |
851 FOR_EACH_OBSERVER(AudioObserver, observers_, OnActiveOutputNodeChanged()); | 861 FOR_EACH_OBSERVER(AudioObserver, observers_, OnActiveOutputNodeChanged()); |
852 } | 862 } |
853 | 863 |
854 } // namespace chromeos | 864 } // namespace chromeos |
OLD | NEW |