forked from Floorp-Projects/Floorp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 865650 - Ensure that looping will only happen if the start offset…
… is less than the end offset; r=padenot
- Loading branch information
Showing
3 changed files
with
52 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
content/media/webaudio/test/test_audioBufferSourceNodeLoopStartEndSame.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<title>Test AudioBufferSourceNode looping</title> | ||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> | ||
<script type="text/javascript" src="webaudio.js"></script> | ||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> | ||
</head> | ||
<body> | ||
<pre id="test"> | ||
<script class="testbody" type="text/javascript"> | ||
|
||
SimpleTest.waitForExplicitFinish(); | ||
addLoadEvent(function() { | ||
SpecialPowers.setBoolPref("media.webaudio.enabled", true); | ||
|
||
var context = new AudioContext(); | ||
var buffer = context.createBuffer(1, 0, context.sampleRate); | ||
|
||
var expectedBuffer = context.createBuffer(1, 2048, context.sampleRate); | ||
|
||
var source = context.createBufferSource(); | ||
source.buffer = buffer; | ||
|
||
var sp = context.createScriptProcessor(2048, 1); | ||
source.loop = true; | ||
source.start(0); | ||
source.connect(sp); | ||
sp.connect(context.destination); | ||
sp.onaudioprocess = function(e) { | ||
is(e.inputBuffer.numberOfChannels, 1, "input buffer must have only one channel"); | ||
compareBuffers(e.inputBuffer.getChannelData(0), expectedBuffer.getChannelData(0)); | ||
|
||
sp.onaudioprocess = null; | ||
|
||
SpecialPowers.clearUserPref("media.webaudio.enabled"); | ||
SimpleTest.finish(); | ||
}; | ||
}); | ||
|
||
</script> | ||
</pre> | ||
</body> | ||
</html> |