Title: [106174] trunk
- Revision
- 106174
- Author
- [email protected]
- Date
- 2012-01-27 19:11:43 -0800 (Fri, 27 Jan 2012)
Log Message
AudioPannerNode::setPanningModel() does not update m_panningModel properly
https://bugs.webkit.org/show_bug.cgi?id=66830
Patch by Raymond Toy <[email protected]> on 2012-01-27
Reviewed by Kenneth Russell.
Source/WebCore:
Test: webaudio/panner-set-model.html
* webaudio/AudioPannerNode.cpp:
(WebCore::AudioPannerNode::setPanningModel): Update
m_panningModel appropriately. Also silently do nothing if the
model is invalid.
LayoutTests:
* webaudio/panner-set-model-expected.txt: Added.
* webaudio/panner-set-model.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (106173 => 106174)
--- trunk/LayoutTests/ChangeLog 2012-01-28 02:16:19 UTC (rev 106173)
+++ trunk/LayoutTests/ChangeLog 2012-01-28 03:11:43 UTC (rev 106174)
@@ -1,3 +1,13 @@
+2012-01-27 Raymond Toy <[email protected]>
+
+ AudioPannerNode::setPanningModel() does not update m_panningModel properly
+ https://bugs.webkit.org/show_bug.cgi?id=66830
+
+ Reviewed by Kenneth Russell.
+
+ * webaudio/panner-set-model-expected.txt: Added.
+ * webaudio/panner-set-model.html: Added.
+
2012-01-27 Michael Saboff <[email protected]>
New Regression Test for r106075
Added: trunk/LayoutTests/webaudio/panner-set-model-expected.txt (0 => 106174)
--- trunk/LayoutTests/webaudio/panner-set-model-expected.txt (rev 0)
+++ trunk/LayoutTests/webaudio/panner-set-model-expected.txt 2012-01-28 03:11:43 UTC (rev 106174)
@@ -0,0 +1,13 @@
+Test if panningModel can be set and read.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+PASS Panner set to EQUALPOWER model and read correctly.
+PASS Panner set to HRTF model and read correctly.
+PASS Panner set to SOUNDFIELD model and read correctly.
+PASS Panner set to invalid model and panningModel did not change.
+PASS Panning model tests passed.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/webaudio/panner-set-model.html (0 => 106174)
--- trunk/LayoutTests/webaudio/panner-set-model.html (rev 0)
+++ trunk/LayoutTests/webaudio/panner-set-model.html 2012-01-28 03:11:43 UTC (rev 106174)
@@ -0,0 +1,82 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+ <head>
+ <link rel="stylesheet" href=""
+ <script src=""
+ <script src=""
+ <title>Test Panner setPanningModel values.</title>
+ </head>
+
+ <body>
+ <div id="description"></div>
+ <div id="console"></div>
+
+ <script>
+ description("Test if panningModel can be set and read.");
+
+ // Test to see if we panningModel is updated when we set it.
+ function runTest() {
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ }
+
+ window.jsTestIsAsync = true;
+
+ var context = new webkitAudioContext();
+ var success = true;
+ var panner = context.createPanner();
+
+ // Set the panning model and see if it can be read back
+ // correctly.
+ panner.panningModel = panner.EQUALPOWER;
+ if (panner.panningModel == 0) {
+ testPassed("Panner set to EQUALPOWER model and read correctly.");
+ } else {
+ testFailed("Panner model set to EQUALPOWER (0) but returned " + panner.panningModel);
+ success = false;
+ }
+
+ panner.panningModel = panner.HRTF;
+ if (panner.panningModel == 1) {
+ testPassed("Panner set to HRTF model and read correctly.");
+ } else {
+ testFailed("Panner model set to HRTF (1) but returned " + panner.panningModel);
+ success = false;
+ }
+
+ panner.panningModel = panner.SOUNDFIELD;
+ if (panner.panningModel == 2) {
+ testPassed("Panner set to SOUNDFIELD model and read correctly.");
+ } else {
+ testFailed("Panner model set to SOUNDFIELD (2) but returned " + panner.panningModel);
+ success = false;
+ }
+
+ // Set to invalid value and make sure it didn't change from
+ // it's previous setting (of 2).
+ panner.panningModel = 99;
+ if (panner.panningModel == 2) {
+ testPassed("Panner set to invalid model and panningModel did not change.");
+ } else {
+ testFailed("Panner set to invalid model, but the panningModel changed from 2 to " + panner.panningModel);
+ success = false;
+ }
+
+ if (success) {
+ testPassed("Panning model tests passed.");
+ } else {
+ testFailed("Panning model tests failed.");
+ }
+
+ finishJSTest();
+ }
+
+ runTest();
+ successfullyParsed = true;
+
+ </script>
+
+ <script src=""
+ </body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (106173 => 106174)
--- trunk/Source/WebCore/ChangeLog 2012-01-28 02:16:19 UTC (rev 106173)
+++ trunk/Source/WebCore/ChangeLog 2012-01-28 03:11:43 UTC (rev 106174)
@@ -1,3 +1,17 @@
+2012-01-27 Raymond Toy <[email protected]>
+
+ AudioPannerNode::setPanningModel() does not update m_panningModel properly
+ https://bugs.webkit.org/show_bug.cgi?id=66830
+
+ Reviewed by Kenneth Russell.
+
+ Test: webaudio/panner-set-model.html
+
+ * webaudio/AudioPannerNode.cpp:
+ (WebCore::AudioPannerNode::setPanningModel): Update
+ m_panningModel appropriately. Also silently do nothing if the
+ model is invalid.
+
2012-01-27 Chris Rogers <[email protected]>
HRTFPanner could have high-quality mode for smoother transitions
Modified: trunk/Source/WebCore/webaudio/AudioPannerNode.cpp (106173 => 106174)
--- trunk/Source/WebCore/webaudio/AudioPannerNode.cpp 2012-01-28 02:16:19 UTC (rev 106173)
+++ trunk/Source/WebCore/webaudio/AudioPannerNode.cpp 2012-01-28 03:11:43 UTC (rev 106174)
@@ -152,9 +152,19 @@
void AudioPannerNode::setPanningModel(unsigned short model)
{
- if (!m_panner.get() || model != m_panningModel) {
- OwnPtr<Panner> newPanner = Panner::create(model, sampleRate());
- m_panner = newPanner.release();
+ switch (model) {
+ case EQUALPOWER:
+ case HRTF:
+ case SOUNDFIELD:
+ if (!m_panner.get() || model != m_panningModel) {
+ OwnPtr<Panner> newPanner = Panner::create(model, sampleRate());
+ m_panner = newPanner.release();
+ m_panningModel = model;
+ }
+ break;
+ default:
+ // FIXME: consider throwing an exception for illegal model values.
+ break;
}
}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes