Ejemplo n.º 1
0
void V8PannerNode::panningModelAttrSetterCustom(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
    PannerNode* imp = V8PannerNode::toNative(info.Holder());

#if ENABLE(LEGACY_WEB_AUDIO)    
    if (value->IsNumber()) {
        bool ok = false;
        uint32_t model = toUInt32(value, ok);
        ASSERT(ok);
        if (!imp->setPanningModel(model))
            throwError(v8TypeError, "Illegal panningModel", info.GetIsolate());
        return;
    }
#endif

    if (value->IsString()) {
        String model = toWebCoreString(value);
        if (model == "equalpower" || model == "HRTF" || model == "soundfield") {
            imp->setPanningModel(model);
            return;
        }
    }
    
    throwError(v8TypeError, "Illegal panningModel", info.GetIsolate());
}
Ejemplo n.º 2
0
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();
}