Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: chromeos/audio/cras_audio_handler.cc

Issue 620673002: Flip the left/right speaker when the device is in yoga mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix the AudioApiTest. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chromeos/audio/cras_audio_handler.h ('k') | chromeos/dbus/cras_audio_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chromeos/audio/cras_audio_handler.h ('k') | chromeos/dbus/cras_audio_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698