OLD | NEW |
1 function createTestBuffer(context, sampleFrameLength) { | 1 function createTestBuffer(context, sampleFrameLength) { |
2 var audioBuffer = context.createBuffer(1, sampleFrameLength, context.sampleR
ate); | 2 var audioBuffer = context.createBuffer(1, sampleFrameLength, context.sampleR
ate); |
3 var channelData = audioBuffer.getChannelData(0); | 3 var channelData = audioBuffer.getChannelData(0); |
4 | 4 |
5 // Create a simple linear ramp starting at zero, with each value in the buff
er equal to its index position. | 5 // Create a simple linear ramp starting at zero, with each value in the buff
er equal to its index position. |
6 for (var i = 0; i < sampleFrameLength; ++i) | 6 for (var i = 0; i < sampleFrameLength; ++i) |
7 channelData[i] = i; | 7 channelData[i] = i; |
8 | 8 |
9 return audioBuffer; | 9 return audioBuffer; |
10 } | 10 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 for (var j = framesToTest; j < testSpacingFrames; ++j) | 59 for (var j = framesToTest; j < testSpacingFrames; ++j) |
60 renderedArray[j - framesToTest] = renderedData[offsetFrame + j]; | 60 renderedArray[j - framesToTest] = renderedData[offsetFrame + j]; |
61 | 61 |
62 var s = description + ": expected: all zeroes actual: " + renderedAr
ray; | 62 var s = description + ": expected: all zeroes actual: " + renderedAr
ray; |
63 testFailed(s); | 63 testFailed(s); |
64 success = false; | 64 success = false; |
65 break; | 65 break; |
66 } | 66 } |
67 } | 67 } |
68 | 68 |
69 if (success) | 69 Should(description, success) |
70 testPassed(description); | 70 .summarize("", ""); |
71 | 71 |
72 return success; | 72 return success; |
73 } | 73 } |
74 | 74 |
75 function checkAllTests(event) { | 75 function checkAllTests(event) { |
76 var renderedBuffer = event.renderedBuffer; | 76 var renderedBuffer = event.renderedBuffer; |
77 for (var i = 0; i < tests.length; ++i) | 77 for (var i = 0; i < tests.length; ++i) |
78 checkSingleTest(renderedBuffer, i); | 78 checkSingleTest(renderedBuffer, i); |
79 | 79 |
80 finishJSTest(); | 80 finishJSTest(); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 113 |
114 // The oscillator output should be amplified accordingly to drive the | 114 // The oscillator output should be amplified accordingly to drive the |
115 // modulation within the desired range. | 115 // modulation within the desired range. |
116 lfo.connect(amp); | 116 lfo.connect(amp); |
117 amp.connect(phasor[modTarget]); | 117 amp.connect(phasor[modTarget]); |
118 | 118 |
119 phasor.connect(context.destination); | 119 phasor.connect(context.destination); |
120 | 120 |
121 lfo.start(); | 121 lfo.start(); |
122 phasor.start(); | 122 phasor.start(); |
123 } | 123 } |
OLD | NEW |