OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 127 |
128 if (event < 0 || event > 15) { | 128 if (event < 0 || event > 15) { |
129 return kParameterError; // Invalid event number. | 129 return kParameterError; // Invalid event number. |
130 } | 130 } |
131 | 131 |
132 if (attenuation < 0 || attenuation > 63) { | 132 if (attenuation < 0 || attenuation > 63) { |
133 return kParameterError; // Invalid attenuation. | 133 return kParameterError; // Invalid attenuation. |
134 } | 134 } |
135 | 135 |
136 // Look up oscillator coefficient for low and high frequencies. | 136 // Look up oscillator coefficient for low and high frequencies. |
137 RTC_DCHECK_LE(0u, fs_index); | 137 RTC_DCHECK_LE(0, fs_index); |
138 RTC_DCHECK_GT(arraysize(kCoeff1), fs_index); | 138 RTC_DCHECK_GT(arraysize(kCoeff1), fs_index); |
139 RTC_DCHECK_GT(arraysize(kCoeff2), fs_index); | 139 RTC_DCHECK_GT(arraysize(kCoeff2), fs_index); |
140 RTC_DCHECK_LE(0, event); | 140 RTC_DCHECK_LE(0, event); |
141 RTC_DCHECK_GT(arraysize(kCoeff1[fs_index]), static_cast<size_t>(event)); | 141 RTC_DCHECK_GT(arraysize(kCoeff1[fs_index]), static_cast<size_t>(event)); |
142 RTC_DCHECK_GT(arraysize(kCoeff2[fs_index]), static_cast<size_t>(event)); | 142 RTC_DCHECK_GT(arraysize(kCoeff2[fs_index]), static_cast<size_t>(event)); |
143 coeff1_ = kCoeff1[fs_index][event]; | 143 coeff1_ = kCoeff1[fs_index][event]; |
144 coeff2_ = kCoeff2[fs_index][event]; | 144 coeff2_ = kCoeff2[fs_index][event]; |
145 | 145 |
146 // Look up amplitude multiplier. | 146 // Look up amplitude multiplier. |
147 RTC_DCHECK_LE(0, attenuation); | 147 RTC_DCHECK_LE(0, attenuation); |
148 RTC_DCHECK_GT(arraysize(kAmplitude), static_cast<size_t>(attenuation)); | 148 RTC_DCHECK_GT(arraysize(kAmplitude), static_cast<size_t>(attenuation)); |
149 amplitude_ = kAmplitude[attenuation]; | 149 amplitude_ = kAmplitude[attenuation]; |
150 | 150 |
151 // Initialize sample history. | 151 // Initialize sample history. |
152 RTC_DCHECK_LE(0u, fs_index); | 152 RTC_DCHECK_LE(0, fs_index); |
153 RTC_DCHECK_GT(arraysize(kInitValue1), fs_index); | 153 RTC_DCHECK_GT(arraysize(kInitValue1), fs_index); |
154 RTC_DCHECK_GT(arraysize(kInitValue2), fs_index); | 154 RTC_DCHECK_GT(arraysize(kInitValue2), fs_index); |
155 RTC_DCHECK_LE(0, event); | 155 RTC_DCHECK_LE(0, event); |
156 RTC_DCHECK_GT(arraysize(kInitValue1[fs_index]), static_cast<size_t>(event)); | 156 RTC_DCHECK_GT(arraysize(kInitValue1[fs_index]), static_cast<size_t>(event)); |
157 RTC_DCHECK_GT(arraysize(kInitValue2[fs_index]), static_cast<size_t>(event)); | 157 RTC_DCHECK_GT(arraysize(kInitValue2[fs_index]), static_cast<size_t>(event)); |
158 sample_history1_[0] = kInitValue1[fs_index][event]; | 158 sample_history1_[0] = kInitValue1[fs_index][event]; |
159 sample_history1_[1] = 0; | 159 sample_history1_[1] = 0; |
160 sample_history2_[0] = kInitValue2[fs_index][event]; | 160 sample_history2_[0] = kInitValue2[fs_index][event]; |
161 sample_history2_[1] = 0; | 161 sample_history2_[1] = 0; |
162 | 162 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 } | 209 } |
210 | 210 |
211 return static_cast<int>(num_samples); | 211 return static_cast<int>(num_samples); |
212 } | 212 } |
213 | 213 |
214 bool DtmfToneGenerator::initialized() const { | 214 bool DtmfToneGenerator::initialized() const { |
215 return initialized_; | 215 return initialized_; |
216 } | 216 } |
217 | 217 |
218 } // namespace webrtc | 218 } // namespace webrtc |
OLD | NEW |