void V8BiquadFilterNode::typeAttributeSetterCustom(v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
{
    ExceptionState exceptionState(ExceptionState::SetterContext, "type", "BiquadFilterNode", info.Holder(), info.GetIsolate());
    BiquadFilterNode* impl = V8BiquadFilterNode::toNative(info.Holder());

    if (value->IsNumber()) {
        uint32_t type = toUInt32(value, exceptionState);
        if (exceptionState.throwIfNeeded())
            return;
        if (!impl->setType(type)) {
            exceptionState.throwTypeError("Illegal BiquadFilterNode type");
            exceptionState.throwIfNeeded();
        }
        return;
    }

    if (value->IsString()) {
        String type = toCoreString(value.As<v8::String>());
        if (type == "lowpass" || type == "highpass" || type == "bandpass" || type == "lowshelf" || type == "highshelf" || type == "peaking" || type == "notch" || type == "allpass") {
            impl->setType(type);
            return;
        }
    }

    exceptionState.throwTypeError("Illegal BiquadFilterNode type");
    exceptionState.throwIfNeeded();
}
示例#2
0
static void typeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.BiquadFilterNode.type._set");
    BiquadFilterNode* imp = V8BiquadFilterNode::toNative(info.Holder());
    int v = toUInt32(value);
    imp->setType(v);
    return;
}
static v8::Handle<v8::Value> getFrequencyResponseCallback(const v8::Arguments& args)
{
    if (args.Length() < 3)
        return throwNotEnoughArgumentsError(args.GetIsolate());
    BiquadFilterNode* imp = V8BiquadFilterNode::toNative(args.Holder());
    V8TRYCATCH(Float32Array*, frequencyHz, V8Float32Array::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8Float32Array::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
    V8TRYCATCH(Float32Array*, magResponse, V8Float32Array::HasInstance(MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined)) ? V8Float32Array::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined))) : 0);
    V8TRYCATCH(Float32Array*, phaseResponse, V8Float32Array::HasInstance(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined)) ? V8Float32Array::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined))) : 0);
    imp->getFrequencyResponse(frequencyHz, magResponse, phaseResponse);
    return v8Undefined();
}
static v8::Handle<v8::Value> gainAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    BiquadFilterNode* imp = V8BiquadFilterNode::toNative(info.Holder());
    RefPtr<AudioParam> result = imp->gain();
    v8::Handle<v8::Value> wrapper = result.get() ? v8::Handle<v8::Value>(DOMDataStore::getWrapper(result.get(), info.GetIsolate())) : v8Undefined();
    if (wrapper.IsEmpty()) {
        wrapper = toV8(result.get(), info.Holder(), info.GetIsolate());
        if (!wrapper.IsEmpty())
            V8DOMWrapper::setNamedHiddenReference(info.Holder(), "gain", wrapper);
    }
    return wrapper;
}
示例#5
0
static v8::Handle<v8::Value> gainAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.BiquadFilterNode.gain._get");
    BiquadFilterNode* imp = V8BiquadFilterNode::toNative(info.Holder());
    RefPtr<AudioParam> result = imp->gain();
    v8::Handle<v8::Value> wrapper = result.get() ? getDOMObjectMap().get(result.get()) : v8::Handle<v8::Value>();
    if (wrapper.IsEmpty()) {
        wrapper = toV8(result.get());
        if (!wrapper.IsEmpty())
            V8DOMWrapper::setNamedHiddenReference(info.Holder(), "gain", wrapper);
    }
    return wrapper;
}
void V8BiquadFilterNode::typeAttributeSetterCustom(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
{
    BiquadFilterNode* imp = V8BiquadFilterNode::toNative(info.Holder());

    if (value->IsNumber()) {
        bool ok = false;
        uint32_t type = toUInt32(value, ok);
        ASSERT(ok);
        if (!imp->setType(type))
            throwTypeError("Illegal BiquadFilterNode type", info.GetIsolate());
        return;
    }

    if (value->IsString()) {
        String type = toWebCoreString(value);
        if (type == "lowpass" || type == "highpass" || type == "bandpass" || type == "lowshelf" || type == "highshelf" || type == "peaking" || type == "notch" || type == "allpass") {
            imp->setType(type);
            return;
        }
    }

    throwTypeError("Illegal BiquadFilterNode type", info.GetIsolate());
}
static v8::Handle<v8::Value> typeAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    BiquadFilterNode* imp = V8BiquadFilterNode::toNative(info.Holder());
    return v8String(imp->type(), info.GetIsolate());
}
示例#8
0
static v8::Handle<v8::Value> typeAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.BiquadFilterNode.type._get");
    BiquadFilterNode* imp = V8BiquadFilterNode::toNative(info.Holder());
    return v8::Integer::New(imp->type());
}