blob: 45170d2aea9732dc9e52b1158fa7e5fe6e1bb441 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<title>
panner-loop.html
</title>
<script src="../../imported/w3c/web-platform-tests/resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../resources/audit-util.js"></script>
<script src="../resources/audit.js"></script>
<script src="../resources/panner-model-testing.js"></script>
</head>
<body>
<script id="layout-test-code">
let audit = Audit.createTaskRunner();
// See crbug.com/331446.
// Create a simple feedback loop and make sure the panner node processes
// it correctly.
audit.define(
{label: 'test', description: 'PannerNode handling of feedback loops'},
(task, should) => {
let sampleRate = 44100;
let renderLengthSeconds = 1;
// Create offline audio context.
let context = new OfflineAudioContext(
2, sampleRate * renderLengthSeconds, sampleRate);
// Create nodes in graph. This is based on the test given in
// crbug.com/331446.
let source = context.createBufferSource();
source.buffer =
createImpulseBuffer(context, sampleRate * renderLengthSeconds);
let activateNode = context.createGain();
let dry = context.createGain();
let wet = context.createGain();
let filter = context.createBiquadFilter();
let delay = context.createDelay();
let feedbackNode = context.createGain();
let output = context.createGain();
delay.delayTime.value = 0.1;
wet.gain.value = 0.5;
dry.gain.value = 1;
feedbackNode.gain.value = 0.45;
filter.frequency.value = 20000;
source.connect(activateNode);
activateNode.connect(delay);
activateNode.connect(dry);
delay.connect(filter);
filter.connect(feedbackNode);
feedbackNode.connect(delay);
feedbackNode.connect(wet);
wet.connect(output);
dry.connect(output);
let panner = context.createPanner();
panner.coneOuterGain = 0.1;
panner.coneOuterAngle = 180;
panner.coneInnerAngle = 0;
panner.connect(context.destination);
output.connect(panner);
// Render. We don't care what the output is, though.
should(context.startRendering(), 'Rendering of offline context')
.beResolved()
.then(() => task.done());
});
audit.run();
</script>
</body>
</html>