Chromium Code Reviews| Index: Source/modules/webaudio/ConvolverNode.cpp |
| diff --git a/Source/modules/webaudio/ConvolverNode.cpp b/Source/modules/webaudio/ConvolverNode.cpp |
| index 0073ae8a6586f54e2073fd256429cc1f8042468e..8f36f915a5145009cad0f4df081b877202b6c642 100644 |
| --- a/Source/modules/webaudio/ConvolverNode.cpp |
| +++ b/Source/modules/webaudio/ConvolverNode.cpp |
| @@ -28,6 +28,8 @@ |
| #include "modules/webaudio/ConvolverNode.h" |
| +#include "bindings/v8/ExceptionState.h" |
| +#include "core/dom/ExceptionCode.h" |
| #include "platform/audio/Reverb.h" |
| #include "modules/webaudio/AudioBuffer.h" |
| #include "modules/webaudio/AudioContext.h" |
| @@ -107,13 +109,21 @@ void ConvolverNode::uninitialize() |
| AudioNode::uninitialize(); |
| } |
| -void ConvolverNode::setBuffer(AudioBuffer* buffer) |
| +void ConvolverNode::setBuffer(AudioBuffer* buffer, ExceptionState& exceptionState) |
| { |
| ASSERT(isMainThread()); |
| if (!buffer) |
| return; |
| + if (buffer->sampleRate() != context()->sampleRate()) { |
| + exceptionState.throwDOMException( |
| + NotSupportedError, |
| + "The buffer sample rate of " + String::number(buffer->sampleRate()) |
| + + " does not match the context rate of " + String::number(context()->sampleRate()) |
| + + " Hz."); |
| + } |
|
tkent
2015/04/08 04:52:35
Should we do |return| here?
Raymond Toy
2015/04/08 15:49:44
Yes!
I'll fix this right away.
|
| + |
| unsigned numberOfChannels = buffer->numberOfChannels(); |
| size_t bufferLength = buffer->length(); |