| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/chromeos/audio/audio_mixer_alsa.h" | 5 #include "chrome/browser/chromeos/audio/audio_mixer_alsa.h" |
| 6 | 6 |
| 7 #include <unistd.h> | 7 #include <unistd.h> |
| 8 | 8 |
| 9 #include <alsa/asoundlib.h> | 9 #include <alsa/asoundlib.h> |
| 10 | 10 |
| 11 #include <algorithm> | 11 #include <algorithm> |
| 12 #include <cmath> | 12 #include <cmath> |
| 13 | 13 |
| 14 #include "base/bind.h" | 14 #include "base/bind.h" |
| 15 #include "base/bind_helpers.h" | 15 #include "base/bind_helpers.h" |
| 16 #include "base/chromeos/chromeos_version.h" | 16 #include "base/chromeos/chromeos_version.h" |
| 17 #include "base/logging.h" | 17 #include "base/logging.h" |
| 18 #include "base/message_loop.h" | 18 #include "base/message_loop.h" |
| 19 #include "base/threading/thread.h" | 19 #include "base/threading/thread.h" |
| 20 #include "base/threading/thread_restrictions.h" | 20 #include "base/threading/thread_restrictions.h" |
| 21 #include "chrome/browser/extensions/extension_tts_api_chromeos.h" | 21 #include "chrome/browser/speech/extension_api/tts_extension_api_chromeos.h" |
| 22 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
| 23 | 23 |
| 24 typedef long alsa_long_t; // 'long' is required for ALSA API calls. | 24 typedef long alsa_long_t; // 'long' is required for ALSA API calls. |
| 25 | 25 |
| 26 using content::BrowserThread; | 26 using content::BrowserThread; |
| 27 using std::string; | 27 using std::string; |
| 28 | 28 |
| 29 namespace chromeos { | 29 namespace chromeos { |
| 30 | 30 |
| 31 namespace { | 31 namespace { |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 (max_volume_db_ - min_volume_db_), 1/kVolumeBias); | 430 (max_volume_db_ - min_volume_db_), 1/kVolumeBias); |
| 431 } | 431 } |
| 432 | 432 |
| 433 double AudioMixerAlsa::PercentToDb(double percent) const { | 433 double AudioMixerAlsa::PercentToDb(double percent) const { |
| 434 lock_.AssertAcquired(); | 434 lock_.AssertAcquired(); |
| 435 return pow(percent / 100.0, kVolumeBias) * | 435 return pow(percent / 100.0, kVolumeBias) * |
| 436 (max_volume_db_ - min_volume_db_) + min_volume_db_; | 436 (max_volume_db_ - min_volume_db_) + min_volume_db_; |
| 437 } | 437 } |
| 438 | 438 |
| 439 } // namespace chromeos | 439 } // namespace chromeos |
| OLD | NEW |