| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 /** | 6 /** |
| 7 * @fileOverview This file includes legacy utility functions for the layout | 7 * @fileOverview This file includes legacy utility functions for the layout |
| 8 * test. | 8 * test. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 // How many frames in a WebAudio render quantum. | |
| 12 let RENDER_QUANTUM_FRAMES = 128; | |
| 13 | 11 |
| 14 function writeString(s, a, offset) { | 12 function writeString(s, a, offset) { |
| 15 for (let i = 0; i < s.length; ++i) { | 13 for (let i = 0; i < s.length; ++i) { |
| 16 a[offset + i] = s.charCodeAt(i); | 14 a[offset + i] = s.charCodeAt(i); |
| 17 } | 15 } |
| 18 } | 16 } |
| 19 | 17 |
| 20 function writeInt16(n, a, offset) { | 18 function writeInt16(n, a, offset) { |
| 21 n = Math.floor(n); | 19 n = Math.floor(n); |
| 22 | 20 |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 let length = Math.min(actual.length, expected.length); | 337 let length = Math.min(actual.length, expected.length); |
| 340 | 338 |
| 341 for (let k = 0; k < length; ++k) { | 339 for (let k = 0; k < length; ++k) { |
| 342 let diff = actual[k] - expected[k]; | 340 let diff = actual[k] - expected[k]; |
| 343 signalPower += expected[k] * expected[k]; | 341 signalPower += expected[k] * expected[k]; |
| 344 noisePower += diff * diff; | 342 noisePower += diff * diff; |
| 345 } | 343 } |
| 346 | 344 |
| 347 return signalPower / noisePower; | 345 return signalPower / noisePower; |
| 348 } | 346 } |
| OLD | NEW |