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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
81 13323, 15021, 15708, 15708, 15708, 15708}, | 81 13323, 15021, 15708, 15708, 15708, 15708}, |
82 { 8207, 7490, 8207, 8979, 7490, 8207, 8979, 7490, 8207, 8979, 7490, 8979, | 82 { 8207, 7490, 8207, 8979, 7490, 8207, 8979, 7490, 8207, 8979, 7490, 8979, |
83 9801, 9801, 9801, 9801}, | 83 9801, 9801, 9801, 9801}, |
84 { 4249, 3853, 4249, 4685, 3853, 4249, 4685, 3853, 4249, 4685, 3853, 4685, | 84 { 4249, 3853, 4249, 4685, 3853, 4249, 4685, 3853, 4249, 4685, 3853, 4685, |
85 5164, 5164, 5164, 5164}, | 85 5164, 5164, 5164, 5164}, |
86 { 2851, 2582, 2851, 3148, 2582, 2851, 3148, 2582, 2851, 3148, 2582, 3148, | 86 { 2851, 2582, 2851, 3148, 2582, 2851, 3148, 2582, 2851, 3148, 2582, 3148, |
87 3476, 3476, 3476, 3476} }; | 87 3476, 3476, 3476, 3476} }; |
88 | 88 |
89 // Amplitude multipliers for volume values 0 through 36, corresponding to | 89 // Amplitude multipliers for volume values 0 through 36, corresponding to |
90 // 0 dBm0 through -36 dBm0. Values are in Q14. | 90 // 0 dBm0 through -36 dBm0. Values are in Q14. |
91 const int DtmfToneGenerator::kAmplitude[37] = { | 91 const int DtmfToneGenerator::kAmplitude[37] = { |
hlundin-webrtc
2016/10/11 09:08:36
You will have to extend this array with values for
the sun
2016/10/11 09:44:53
Done.
| |
92 16141, 14386, 12821, 11427, 10184, 9077, 8090, 7210, 6426, 5727, 5104, 4549, | 92 16141, 14386, 12821, 11427, 10184, 9077, 8090, 7210, 6426, 5727, 5104, 4549, |
93 4054, 3614, 3221, 2870, 2558, 2280, 2032, 1811, 1614, 1439, 1282, 1143, | 93 4054, 3614, 3221, 2870, 2558, 2280, 2032, 1811, 1614, 1439, 1282, 1143, |
94 1018, 908, 809, 721, 643, 573, 510, 455, 405, 361, 322, 287, 256 }; | 94 1018, 908, 809, 721, 643, 573, 510, 455, 405, 361, 322, 287, 256 }; |
95 | 95 |
96 // Constructor. | 96 // Constructor. |
97 DtmfToneGenerator::DtmfToneGenerator() | 97 DtmfToneGenerator::DtmfToneGenerator() |
98 : initialized_(false), | 98 : initialized_(false), |
99 coeff1_(0), | 99 coeff1_(0), |
100 coeff2_(0), | 100 coeff2_(0), |
101 amplitude_(0) { | 101 amplitude_(0) { |
(...skipping 15 matching lines...) Expand all 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 |