本文整理汇总了C++中PannerNode::setDistanceModel方法的典型用法代码示例。如果您正苦于以下问题:C++ PannerNode::setDistanceModel方法的具体用法?C++ PannerNode::setDistanceModel怎么用?C++ PannerNode::setDistanceModel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PannerNode
的用法示例。
在下文中一共展示了PannerNode::setDistanceModel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ENABLE
void V8PannerNode::distanceModelAttrSetterCustom(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->setDistanceModel(model))
throwError(v8TypeError, "Illegal distanceModel", info.GetIsolate());
return;
}
#endif
if (value->IsString()) {
String model = toWebCoreString(value);
if (model == "linear" || model == "inverse" || model == "exponential") {
imp->setDistanceModel(model);
return;
}
}
throwError(v8TypeError, "Illegal distanceModel", info.GetIsolate());
}
示例2: exceptionState
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();
}