OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chromeos/audio/audio_a11y_controller.h" |
| 6 |
| 7 #include <vector> |
| 8 |
| 9 #include "chromeos/dbus/cras_audio_client.h" |
| 10 #include "chromeos/dbus/dbus_thread_manager.h" |
| 11 |
| 12 namespace chromeos { |
| 13 namespace { |
| 14 static const std::vector<double> kStereoToMono = {0.5, 0.5, 0.5, 0.5}; |
| 15 static const std::vector<double> kStereoToStereo = {1, 0, 0, 1}; |
| 16 } // namespace |
| 17 |
| 18 AudioA11yController::AudioA11yController() {} |
| 19 |
| 20 AudioA11yController::~AudioA11yController() {} |
| 21 |
| 22 void AudioA11yController::SetOutputMono(bool enabled) { |
| 23 if (output_mono_enabled_ == enabled) |
| 24 return; |
| 25 output_mono_enabled_ = enabled; |
| 26 |
| 27 if (output_mono_enabled_) { |
| 28 chromeos::DBusThreadManager::Get()->GetCrasAudioClient()-> |
| 29 SetGlobalOutputChannelRemix(channels_, kStereoToMono); |
| 30 } else { |
| 31 chromeos::DBusThreadManager::Get()->GetCrasAudioClient()-> |
| 32 SetGlobalOutputChannelRemix(channels_, kStereoToStereo); |
| 33 } |
| 34 } |
| 35 |
| 36 bool AudioA11yController::IsOutputMonoEnabled() const { |
| 37 return output_mono_enabled_; |
| 38 } |
| 39 |
| 40 } // namespace chromeos |
| 41 |
| 42 |
| 43 |
| 44 |
OLD | NEW |