OLD | NEW |
1 <!doctype html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Test Oscillator Node: sawtooth</title> | 4 <title> |
| 5 Test Oscillator Node: sawtooth |
| 6 </title> |
5 <script src="../../resources/testharness.js"></script> | 7 <script src="../../resources/testharness.js"></script> |
6 <script src="../../resources/testharnessreport.js"></script> | 8 <script src="../../resources/testharnessreport.js"></script> |
7 <script src="../resources/audit-util.js"></script> | 9 <script src="../resources/audit-util.js"></script> |
8 <script src="../resources/audit.js"></script> | 10 <script src="../resources/audit.js"></script> |
9 <script src="../resources/buffer-loader.js"></script> | 11 <script src="../resources/buffer-loader.js"></script> |
10 <script src="../resources/oscillator-testing.js"></script> | 12 <script src="../resources/oscillator-testing.js"></script> |
11 </head> | 13 </head> |
12 | |
13 <body> | 14 <body> |
14 <script> | 15 <script id="layout-test-code"> |
15 let audit = Audit.createTaskRunner(); | 16 let audit = Audit.createTaskRunner(); |
16 | 17 |
17 // Create an offline context with a sample rate that is very different fro
m the sample rate | 18 // Create an offline context with a sample rate that is very different |
18 // used in the OscillatorTestingUtils. This will create a internal Period
icWave objects for | 19 // from the sample rate used in the OscillatorTestingUtils. This will |
19 // the Oscillator. This should not interfere with the oscillator test usi
ng a different | 20 // create a internal PeriodicWave objects for the Oscillator. This should |
20 // context with a different sample rate. | 21 // not interfere with the oscillator test using a different context with a |
| 22 // different sample rate. |
21 | 23 |
22 audit.define("test", (task, should) => { | 24 audit.define('test', (task, should) => { |
23 let context0 = new OfflineAudioContext(1, 1, 3000); | 25 let context0 = new OfflineAudioContext(1, 1, 3000); |
24 let osc = context0.createOscillator(); | 26 let osc = context0.createOscillator(); |
25 osc.type = "sawtooth"; | 27 osc.type = 'sawtooth'; |
26 osc = null; | 28 osc = null; |
27 | 29 |
28 // This test is identical to the test in osc-sawtooth-sweep-snr.html. | 30 // This test is identical to the test in osc-sawtooth-sweep-snr.html. |
29 let tester = OscillatorTestingUtils; | 31 let tester = OscillatorTestingUtils; |
30 | 32 |
31 let context = new OfflineAudioContext(1, tester.sampleRate * | 33 let context = new OfflineAudioContext( |
32 tester.lengthInSeconds, tester.sampleRate); | 34 1, tester.sampleRate * tester.lengthInSeconds, tester.sampleRate); |
33 // The thresholds are experimentally determined. | 35 // The thresholds are experimentally determined. |
34 tester.setThresholds({ | 36 tester.setThresholds({snr: 80.00, maxDiff: 4.06}); |
35 snr: 80.00, | 37 tester.runTest( |
36 maxDiff: 4.06 | 38 context, 'sawtooth', 'Sawtooth PeriodicWave Test', task, should); |
37 }); | |
38 tester.runTest(context, "sawtooth", "Sawtooth PeriodicWave Test", | |
39 task, should); | |
40 }); | 39 }); |
41 | 40 |
42 audit.run(); | 41 audit.run(); |
43 </script> | 42 </script> |
44 </body> | 43 </body> |
45 </html> | 44 </html> |
OLD | NEW |