OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| 2 <html> |
| 3 <head> |
| 4 <script src="resources/audio-testing.js"></script> |
| 5 <script src="../resources/js-test.js"></script> |
| 6 <script src="resources/panner-model-testing.js"></script> |
| 7 </head> |
| 8 |
| 9 <body> |
| 10 <div id="description"></div> |
| 11 <div id="console"></div> |
| 12 <script> |
| 13 description("Test PannerNode handling of feedback loops"); |
| 14 |
| 15 // See crbug.com/331446. |
| 16 |
| 17 // Create a simple feedback loop and make sure the panner node processes i
t correctly. |
| 18 |
| 19 function runTest() { |
| 20 if (window.testRunner) { |
| 21 testRunner.dumpAsText(); |
| 22 testRunner.waitUntilDone(); |
| 23 } |
| 24 |
| 25 window.jsTestIsAsync = true; |
| 26 |
| 27 var sampleRate = 44100; |
| 28 var renderLengthSeconds = 1; |
| 29 |
| 30 // Create offline audio context. |
| 31 var context = new webkitOfflineAudioContext(2, sampleRate * renderLeng
thSeconds, sampleRate); |
| 32 |
| 33 // Create nodes in graph. This is based on the test given in crbug.com
/331446. |
| 34 var source = context.createBufferSource(); |
| 35 source.buffer = createImpulseBuffer(context, sampleRate * renderLength
Seconds); |
| 36 var activateNode = context.createGainNode(); |
| 37 var dry = context.createGainNode(); |
| 38 var wet = context.createGainNode(); |
| 39 var filter = context.createBiquadFilter(); |
| 40 var delay = context.createDelayNode(); |
| 41 var feedbackNode = context.createGainNode(); |
| 42 var output = context.createGainNode(); |
| 43 |
| 44 delay.delayTime.value = 0.1; |
| 45 wet.gain.value = 0.5; |
| 46 dry.gain.value = 1; |
| 47 feedbackNode.gain.value = 0.45; |
| 48 filter.frequency.value = 20000; |
| 49 |
| 50 source.connect(activateNode); |
| 51 activateNode.connect(delay); |
| 52 activateNode.connect(dry); |
| 53 delay.connect(filter); |
| 54 filter.connect(feedbackNode); |
| 55 feedbackNode.connect(delay); |
| 56 feedbackNode.connect(wet); |
| 57 wet.connect(output); |
| 58 dry.connect(output); |
| 59 |
| 60 var panner = context.createPanner(); |
| 61 panner.coneOuterGain = 0.1; |
| 62 panner.coneOuterAngle = 180; |
| 63 panner.coneInnerAngle = 0; |
| 64 |
| 65 panner.connect(context.destination); |
| 66 |
| 67 output.connect(panner); |
| 68 |
| 69 // Render. We don't care what the output is, though. |
| 70 |
| 71 context.oncomplete = function (event) { |
| 72 testPassed("Rendering successfully completed.
"); |
| 73 finishJSTest(); |
| 74 }; |
| 75 context.startRendering(); |
| 76 } |
| 77 |
| 78 runTest(); |
| 79 successfullyParsed = true; |
| 80 </script> |
| 81 |
| 82 </body> |
| 83 </html> |
OLD | NEW |