summaryrefslogtreecommitdiffstats
path: root/chromeos/audio
diff options
context:
space:
mode:
authorjennyz <jennyz@chromium.org>2014-10-01 19:06:44 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-02 02:07:22 +0000
commitcdeffd2c7a44895aafbf1f615cc3937ea2fd280a (patch)
treed66f0e9a53c445f23e9f25b84ef3aa3105acd24c /chromeos/audio
parent8a4459122520cd7d59be4f3b03a2a7eb74344a71 (diff)
downloadchromium_src-cdeffd2c7a44895aafbf1f615cc3937ea2fd280a.zip
chromium_src-cdeffd2c7a44895aafbf1f615cc3937ea2fd280a.tar.gz
chromium_src-cdeffd2c7a44895aafbf1f615cc3937ea2fd280a.tar.bz2
Flip the left/right speaker when the device is in yoga mode.
BUG=418656 Review URL: https://codereview.chromium.org/620673002 Cr-Commit-Position: refs/heads/master@{#297766}
Diffstat (limited to 'chromeos/audio')
-rw-r--r--chromeos/audio/cras_audio_handler.cc13
-rw-r--r--chromeos/audio/cras_audio_handler.h6
2 files changed, 19 insertions, 0 deletions
diff --git a/chromeos/audio/cras_audio_handler.cc b/chromeos/audio/cras_audio_handler.cc
index c645311..d3d0d90 100644
--- a/chromeos/audio/cras_audio_handler.cc
+++ b/chromeos/audio/cras_audio_handler.cc
@@ -253,6 +253,19 @@ void CrasAudioHandler::RemoveAllActiveNodes() {
}
}
+void CrasAudioHandler::SwapInternalSpeakerLeftRightChannel(bool swap) {
+ for (AudioDeviceMap::const_iterator it = audio_devices_.begin();
+ it != audio_devices_.end();
+ ++it) {
+ const AudioDevice& device = it->second;
+ if (!device.is_input && device.type == AUDIO_TYPE_INTERNAL_SPEAKER) {
+ chromeos::DBusThreadManager::Get()->GetCrasAudioClient()->SwapLeftRight(
+ device.id, swap);
+ break;
+ }
+ }
+}
+
bool CrasAudioHandler::has_alternative_input() const {
return has_alternative_input_;
}
diff --git a/chromeos/audio/cras_audio_handler.h b/chromeos/audio/cras_audio_handler.h
index 9f6520e..a377cf5 100644
--- a/chromeos/audio/cras_audio_handler.h
+++ b/chromeos/audio/cras_audio_handler.h
@@ -184,6 +184,12 @@ class CHROMEOS_EXPORT CrasAudioHandler : public CrasAudioClient::Observer,
// Removes all active audio nodes, including the primary active ones.
virtual void RemoveAllActiveNodes();
+ // Swaps the left and right channel of the internal speaker.
+ // Swap the left and right channel if |swap| is true; otherwise, swap the left
+ // and right channel back to the normal mode.
+ // If the feature is not supported on the device, nothing happens.
+ virtual void SwapInternalSpeakerLeftRightChannel(bool swap);
+
// Enables error logging.
virtual void LogErrors();