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

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: Change internal speaker channel mode OnDisplayAdded. 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
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::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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698