OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../resources/testharness.js"></script> | 4 <script src="../../resources/testharness.js"></script> |
5 <script src="../../resources/testharnessreport.js"></script> | 5 <script src="../../resources/testharnessreport.js"></script> |
6 <script src="../resources/audit-util.js"></script> | 6 <script src="../resources/audit-util.js"></script> |
7 <script src="../resources/audit.js"></script> | 7 <script src="../resources/audit.js"></script> |
8 </head> | 8 </head> |
9 | 9 |
10 <body> | 10 <body> |
11 <script> | 11 <script> |
12 var audit = Audit.createTaskRunner(); | 12 var audit = Audit.createTaskRunner(); |
13 | 13 |
14 var context; | 14 var context; |
15 var renderQuantum = 128; | 15 var renderQuantum = 128; |
16 var renderDuration = 3; | 16 var renderDuration = 3; |
17 | 17 |
18 // The sample rate is multiple of the rendering quantum, so suspension | 18 // The sample rate is multiple of the rendering quantum, so suspension |
19 // times fall in to the render quantum boundary. | 19 // times fall in to the render quantum boundary. |
20 var sampleRate = renderQuantum * 100; | 20 var sampleRate = renderQuantum * 100; |
21 | 21 |
22 // Suspend at 1 second and activate the source node. The audio output | 22 // Suspend at 1 second and activate the source node. The audio output |
23 // should be 1.0 from |suspendTime1| to the next suspension. | 23 // should be 1.0 from |suspendTime1| to the next suspension. |
24 var suspendTime1 = 1; | 24 var suspendTime1 = 1; |
25 | 25 |
26 // Suspend at 2 seconds and disconnect the node. The audio output should | 26 // Suspend at 2 seconds and disconnect the node. The audio output should |
27 // be 0.0 from |suspendTime2| to the end. | 27 // be 0.0 from |suspendTime2| to the end. |
28 var suspendTime2 = 2; | 28 var suspendTime2 = 2; |
29 | 29 |
30 audit.define('test', (task, should) => { | 30 audit.define({ |
31 task.describe('Synchronous graph manipulation with suspend() and resume(
)'); | 31 label: 'test', |
| 32 description: 'Synchronous graph manipulation with suspend() and resume()
' |
| 33 }, (task, should) => { |
32 context = new OfflineAudioContext(1, sampleRate * renderDuration, | 34 context = new OfflineAudioContext(1, sampleRate * renderDuration, |
33 sampleRate); | 35 sampleRate); |
34 | 36 |
35 // Create a constant buffer of 1.0. | 37 // Create a constant buffer of 1.0. |
36 var constantBuffer = createConstantBuffer(context, 1, 1.0); | 38 var constantBuffer = createConstantBuffer(context, 1, 1.0); |
37 var constantSource = context.createBufferSource(); | 39 var constantSource = context.createBufferSource(); |
38 constantSource.buffer = constantBuffer; | 40 constantSource.buffer = constantBuffer; |
39 constantSource.loop = true; | 41 constantSource.loop = true; |
40 | 42 |
41 // The audio output from the beginning (0.0 second) to the first suspend | 43 // The audio output from the beginning (0.0 second) to the first suspend |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 should(subarray2, 'Buffer frame [' + suspendIndex2 + ', ' + endIndex + | 102 should(subarray2, 'Buffer frame [' + suspendIndex2 + ', ' + endIndex + |
101 ')') | 103 ')') |
102 .beConstantValueOf(0); | 104 .beConstantValueOf(0); |
103 } | 105 } |
104 | 106 |
105 audit.run(); | 107 audit.run(); |
106 </script> | 108 </script> |
107 | 109 |
108 </body> | 110 </body> |
109 </html> | 111 </html> |
OLD | NEW |