OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 /** | 5 /** |
6 * @fileoverview This is the low-level class that generates ChromeVox's | 6 * @fileoverview This is the low-level class that generates ChromeVox's |
7 * earcons. It's designed to be self-contained and not depend on the | 7 * earcons. It's designed to be self-contained and not depend on the |
8 * rest of the code. | 8 * rest of the code. |
9 */ | 9 */ |
10 | 10 |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 * The chain is hooked up to the destination automatically, so you | 189 * The chain is hooked up to the destination automatically, so you |
190 * just need to connect your source to the return value from this | 190 * just need to connect your source to the return value from this |
191 * method. | 191 * method. |
192 * | 192 * |
193 * @param {{gain: (number | undefined), | 193 * @param {{gain: (number | undefined), |
194 * pan: (number | undefined), | 194 * pan: (number | undefined), |
195 * reverb: (number | undefined)}} properties | 195 * reverb: (number | undefined)}} properties |
196 * An object where you can override the default | 196 * An object where you can override the default |
197 * gain, pan, and reverb, otherwise these are taken from | 197 * gain, pan, and reverb, otherwise these are taken from |
198 * masterVolume, masterPan, and masterReverb. | 198 * masterVolume, masterPan, and masterReverb. |
199 * @return {AudioNode} The filters to be applied to all sounds, connected | 199 * @return {!AudioNode} The filters to be applied to all sounds, connected |
200 * to the destination node. | 200 * to the destination node. |
201 */ | 201 */ |
202 EarconEngine.prototype.createCommonFilters = function(properties) { | 202 EarconEngine.prototype.createCommonFilters = function(properties) { |
203 var gain = this.masterVolume; | 203 var gain = this.masterVolume; |
204 if (properties.gain) { | 204 if (properties.gain) { |
205 gain *= properties.gain; | 205 gain *= properties.gain; |
206 } | 206 } |
207 var gainNode = this.context_.createGain(); | 207 var gainNode = this.context_.createGain(); |
208 gainNode.gain.value = gain; | 208 gainNode.gain.value = gain; |
209 var first = gainNode; | 209 var first = gainNode; |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 | 729 |
730 // Clamp. | 730 // Clamp. |
731 x = Math.min(Math.max(x, 0.0), 1.0); | 731 x = Math.min(Math.max(x, 0.0), 1.0); |
732 | 732 |
733 // Map to between the negative maximum pan x position and the positive max x | 733 // Map to between the negative maximum pan x position and the positive max x |
734 // pan position. | 734 // pan position. |
735 x = (2 * x - 1) * EarconEngine.MAX_PAN_ABS_X_POSITION; | 735 x = (2 * x - 1) * EarconEngine.MAX_PAN_ABS_X_POSITION; |
736 | 736 |
737 this.masterPan = x; | 737 this.masterPan = x; |
738 }; | 738 }; |
OLD | NEW |