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 "base/logging.h" | 5 #include "base/logging.h" |
6 #include "media/audio/audio_input_stream_impl.h" | 6 #include "media/audio/audio_input_stream_impl.h" |
7 | 7 |
8 namespace media { | |
9 | |
10 static const int kMinIntervalBetweenVolumeUpdatesMs = 1000; | 8 static const int kMinIntervalBetweenVolumeUpdatesMs = 1000; |
11 | 9 |
12 AudioInputStreamImpl::AudioInputStreamImpl() | 10 AudioInputStreamImpl::AudioInputStreamImpl() |
13 : agc_is_enabled_(false), | 11 : agc_is_enabled_(false), |
14 max_volume_(0.0), | 12 max_volume_(0.0), |
15 normalized_volume_(0.0) { | 13 normalized_volume_(0.0) { |
16 } | 14 } |
17 | 15 |
18 AudioInputStreamImpl::~AudioInputStreamImpl() {} | 16 AudioInputStreamImpl::~AudioInputStreamImpl() {} |
19 | 17 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 max_volume_ = GetMaxVolume(); | 59 max_volume_ = GetMaxVolume(); |
62 } | 60 } |
63 | 61 |
64 if (max_volume_ != 0.0) { | 62 if (max_volume_ != 0.0) { |
65 // Retrieve the current volume level by asking the audio hardware. | 63 // Retrieve the current volume level by asking the audio hardware. |
66 // Range is normalized to [0.0,1.0] or [0.0, 1.5] on Linux. | 64 // Range is normalized to [0.0,1.0] or [0.0, 1.5] on Linux. |
67 normalized_volume_ = GetVolume() / max_volume_; | 65 normalized_volume_ = GetVolume() / max_volume_; |
68 } | 66 } |
69 } | 67 } |
70 | 68 |
71 } // namespace media | |
OLD | NEW |