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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 fs_index = 3; | 117 fs_index = 3; |
118 } else { | 118 } else { |
119 assert(false); | 119 assert(false); |
120 fs_index = 1; // Default to 8000 Hz. | 120 fs_index = 1; // Default to 8000 Hz. |
121 } | 121 } |
122 | 122 |
123 if (event < 0 || event > 15) { | 123 if (event < 0 || event > 15) { |
124 return kParameterError; // Invalid event number. | 124 return kParameterError; // Invalid event number. |
125 } | 125 } |
126 | 126 |
127 if (attenuation < 0 || attenuation > 36) { | 127 if (attenuation < 0 || attenuation > 63) { |
128 return kParameterError; // Invalid attenuation. | 128 return kParameterError; // Invalid attenuation. |
129 } | 129 } |
130 | 130 |
131 // Look up oscillator coefficient for low and high frequencies. | 131 // Look up oscillator coefficient for low and high frequencies. |
132 coeff1_ = kCoeff1[fs_index][event]; | 132 coeff1_ = kCoeff1[fs_index][event]; |
133 coeff2_ = kCoeff2[fs_index][event]; | 133 coeff2_ = kCoeff2[fs_index][event]; |
134 // Look up amplitude multiplier. | 134 // Look up amplitude multiplier. |
135 amplitude_ = kAmplitude[attenuation]; | 135 amplitude_ = kAmplitude[attenuation]; |
136 // Initialize sample history. | 136 // Initialize sample history. |
137 sample_history1_[0] = kInitValue1[fs_index][event]; | 137 sample_history1_[0] = kInitValue1[fs_index][event]; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 } | 187 } |
188 | 188 |
189 return static_cast<int>(num_samples); | 189 return static_cast<int>(num_samples); |
190 } | 190 } |
191 | 191 |
192 bool DtmfToneGenerator::initialized() const { | 192 bool DtmfToneGenerator::initialized() const { |
193 return initialized_; | 193 return initialized_; |
194 } | 194 } |
195 | 195 |
196 } // namespace webrtc | 196 } // namespace webrtc |
OLD | NEW |