Index: Source/modules/webaudio/WaveShaperNode.cpp |
diff --git a/Source/modules/webaudio/WaveShaperNode.cpp b/Source/modules/webaudio/WaveShaperNode.cpp |
index 42dc22713c6eaa6c38be84e051173884201e2d5c..ea3a9cecb1ebcf1f03e9bdcc6b49a7993e034911 100644 |
--- a/Source/modules/webaudio/WaveShaperNode.cpp |
+++ b/Source/modules/webaudio/WaveShaperNode.cpp |
@@ -27,6 +27,8 @@ |
#if ENABLE(WEB_AUDIO) |
#include "modules/webaudio/WaveShaperNode.h" |
+ |
+#include "core/dom/ExceptionCode.h" |
#include "wtf/MainThread.h" |
namespace WebCore { |
@@ -37,6 +39,8 @@ WaveShaperNode::WaveShaperNode(AudioContext* context) |
ScriptWrappable::init(this); |
m_processor = adoptPtr(new WaveShaperProcessor(context->sampleRate(), 1)); |
setNodeType(NodeTypeWaveShaper); |
+ |
+ initialize(); |
} |
void WaveShaperNode::setCurve(Float32Array* curve) |
@@ -50,6 +54,33 @@ Float32Array* WaveShaperNode::curve() |
return waveShaperProcessor()->curve(); |
} |
+void WaveShaperNode::setOversample(const String& type, ExceptionCode& ec) |
+{ |
+ if (type == "none") |
+ waveShaperProcessor()->setOversample(WaveShaperProcessor::OverSampleNone); |
+ else if (type == "2x") |
+ waveShaperProcessor()->setOversample(WaveShaperProcessor::OverSample2x); |
+ else if (type == "4x") |
+ waveShaperProcessor()->setOversample(WaveShaperProcessor::OverSample4x); |
+ else |
+ ec = INVALID_STATE_ERR; |
+} |
+ |
+String WaveShaperNode::oversample() const |
+{ |
+ switch (const_cast<WaveShaperNode*>(this)->waveShaperProcessor()->oversample()) { |
+ case WaveShaperProcessor::OverSampleNone: |
+ return "none"; |
+ case WaveShaperProcessor::OverSample2x: |
+ return "2x"; |
+ case WaveShaperProcessor::OverSample4x: |
+ return "4x"; |
+ default: |
+ ASSERT_NOT_REACHED(); |
+ return "none"; |
+ } |
+} |
+ |
} // namespace WebCore |
#endif // ENABLE(WEB_AUDIO) |