66 lines
1.5 KiB
HTML
66 lines
1.5 KiB
HTML
<!DOCTYPE html>
|
|
|
|
<!--
|
|
Create two sources and play them simultaneously. This tests unity-gain summing of AudioNode inputs.
|
|
The result should be some laughing playing at the same time as the drumming.
|
|
-->
|
|
|
|
<html>
|
|
<head>
|
|
<script type="text/javascript" src="resources/audio-testing.js"></script>
|
|
<script type="text/javascript" src="resources/buffer-loader.js"></script>
|
|
|
|
</head>
|
|
<body>
|
|
|
|
<script>
|
|
|
|
window.onload = init;
|
|
|
|
var sampleRate = 44100.0;
|
|
var lengthInSeconds = 2;
|
|
|
|
var context = 0;
|
|
var bufferLoader = 0;
|
|
|
|
function init() {
|
|
if (!window.testRunner)
|
|
return;
|
|
|
|
// Create offline audio context.
|
|
context = new OfflineAudioContext(2, sampleRate * lengthInSeconds, sampleRate);
|
|
|
|
bufferLoader = new BufferLoader(
|
|
context,
|
|
[
|
|
"resources/hyper-reality/br-jam-loop.wav",
|
|
"resources/hyper-reality/laughter.wav",
|
|
],
|
|
finishedLoading
|
|
);
|
|
|
|
bufferLoader.load();
|
|
testRunner.waitUntilDone();
|
|
}
|
|
|
|
function finishedLoading(bufferList) {
|
|
// Create two sources and play them at the same time.
|
|
var source1 = context.createBufferSource();
|
|
var source2 = context.createBufferSource();
|
|
source1.buffer = bufferList[0];
|
|
source2.buffer = bufferList[1];
|
|
|
|
source1.connect(context.destination);
|
|
source2.connect(context.destination);
|
|
source1.start(0);
|
|
source2.start(0);
|
|
|
|
context.oncomplete = finishAudioTest;
|
|
context.startRendering();
|
|
}
|
|
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|