This source file includes following definitions.
- panningModelAttributeSetterCustom
- distanceModelAttributeSetterCustom
#include "config.h"
#if ENABLE(WEB_AUDIO)
#include "V8PannerNode.h"
#include "bindings/v8/ExceptionState.h"
#include "bindings/v8/V8Binding.h"
#include "modules/webaudio/PannerNode.h"
namespace WebCore {
void V8PannerNode::panningModelAttributeSetterCustom(v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
{
ExceptionState exceptionState(ExceptionState::SetterContext, "panningModel", "PannerNode", info.Holder(), info.GetIsolate());
PannerNode* impl = V8PannerNode::toNative(info.Holder());
if (value->IsNumber()) {
uint32_t model = toUInt32(value, exceptionState);
if (exceptionState.throwIfNeeded())
return;
if (!impl->setPanningModel(model)) {
exceptionState.throwTypeError("Illegal panningModel");
exceptionState.throwIfNeeded();
}
return;
}
if (value->IsString()) {
String model = toCoreString(value.As<v8::String>());
if (model == "equalpower" || model == "HRTF") {
impl->setPanningModel(model);
return;
}
}
exceptionState.throwTypeError("Illegal panningModel");
exceptionState.throwIfNeeded();
}
void V8PannerNode::distanceModelAttributeSetterCustom(v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
{
ExceptionState exceptionState(ExceptionState::SetterContext, "distanceModel", "PannerNode", info.Holder(), info.GetIsolate());
PannerNode* impl = V8PannerNode::toNative(info.Holder());
if (value->IsNumber()) {
uint32_t model = toUInt32(value, exceptionState);
if (exceptionState.throwIfNeeded())
return;
if (!impl->setDistanceModel(model)) {
exceptionState.throwTypeError("Illegal distanceModel");
exceptionState.throwIfNeeded();
}
return;
}
if (value->IsString()) {
String model = toCoreString(value.As<v8::String>());
if (model == "linear" || model == "inverse" || model == "exponential") {
impl->setDistanceModel(model);
return;
}
}
exceptionState.throwTypeError("Illegal distanceModel");
exceptionState.throwIfNeeded();
}
}
#endif