当前位置: 首页>>代码示例>>C++>>正文


C++ AudioBufferSourceNode类代码示例

本文整理汇总了C++中AudioBufferSourceNode的典型用法代码示例。如果您正苦于以下问题:C++ AudioBufferSourceNode类的具体用法?C++ AudioBufferSourceNode怎么用?C++ AudioBufferSourceNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AudioBufferSourceNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ASSERT

void PannerNode::notifyAudioSourcesConnectedToNode(AudioNode* node, HashMap<AudioNode*, bool>& visitedNodes)
{
    ASSERT(node);
    if (!node)
        return;

    // First check if this node is an AudioBufferSourceNode. If so, let it know about us so that doppler shift pitch can be taken into account.
    if (node->nodeType() == NodeTypeAudioBufferSource) {
        AudioBufferSourceNode* bufferSourceNode = static_cast<AudioBufferSourceNode*>(node);
        bufferSourceNode->setPannerNode(this);
    } else {
        // Go through all inputs to this node.
        for (unsigned i = 0; i < node->numberOfInputs(); ++i) {
            AudioNodeInput* input = node->input(i);

            // For each input, go through all of its connections, looking for AudioBufferSourceNodes.
            for (unsigned j = 0; j < input->numberOfRenderingConnections(); ++j) {
                AudioNodeOutput* connectedOutput = input->renderingOutput(j);
                AudioNode* connectedNode = connectedOutput->node();
                HashMap<AudioNode*, bool>::iterator iterator = visitedNodes.find(connectedNode);

                // If we've seen this node already, we don't need to process it again. Otherwise,
                // mark it as visited and recurse through the node looking for sources.
                if (iterator == visitedNodes.end()) {
                    visitedNodes.set(connectedNode, true);
                    notifyAudioSourcesConnectedToNode(connectedNode, visitedNodes); // recurse
                }
            }
        }
    }
}
开发者ID:smil-in-javascript,项目名称:blink,代码行数:31,代码来源:PannerNode.cpp

示例2: ASSERT

void PannerNode::notifyAudioSourcesConnectedToNode(AudioNode* node, HashSet<AudioNode*>& visitedNodes)
{
    ASSERT(node);
    if (!node)
        return;
        
    // First check if this node is an AudioBufferSourceNode. If so, let it know about us so that doppler shift pitch can be taken into account.
    if (node->nodeType() == NodeTypeAudioBufferSource) {
        AudioBufferSourceNode* bufferSourceNode = reinterpret_cast<AudioBufferSourceNode*>(node);
        bufferSourceNode->setPannerNode(this);
    } else {    
        // Go through all inputs to this node.
        for (unsigned i = 0; i < node->numberOfInputs(); ++i) {
            AudioNodeInput* input = node->input(i);

            // For each input, go through all of its connections, looking for AudioBufferSourceNodes.
            for (unsigned j = 0; j < input->numberOfRenderingConnections(); ++j) {
                AudioNodeOutput* connectedOutput = input->renderingOutput(j);
                AudioNode* connectedNode = connectedOutput->node();
                if (visitedNodes.contains(connectedNode))
                    continue;

                visitedNodes.add(connectedNode);
                notifyAudioSourcesConnectedToNode(connectedNode, visitedNodes);
            }
        }
    }
}
开发者ID:biddyweb,项目名称:switch-oss,代码行数:28,代码来源:PannerNode.cpp

示例3: loopAttrSetter

static void loopAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
    AudioBufferSourceNode* imp = V8AudioBufferSourceNode::toNative(info.Holder());
    bool v = value->BooleanValue();
    imp->setLoop(v);
    return;
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:7,代码来源:V8AudioBufferSourceNode.cpp

示例4: ASSERT

void PannerNode::notifyAudioSourcesConnectedToNode(ContextRenderLock& r, AudioNode* node)
{
    ASSERT(node);
    if (!node)
        return;
        
    // First check if this node is an AudioBufferSourceNode. If so, let it know about us so that doppler shift pitch can be taken into account.
    if (node->nodeType() == NodeTypeAudioBufferSource) 
	{
        AudioBufferSourceNode* bufferSourceNode = reinterpret_cast<AudioBufferSourceNode*>(node);
        bufferSourceNode->setPannerNode(this);
    }
    else
	{
        // Go through all inputs to this node.
        for (unsigned i = 0; i < node->numberOfInputs(); ++i)
		{
            auto input = node->input(i);

            // For each input, go through all of its connections, looking for AudioBufferSourceNodes.
            for (unsigned j = 0; j < input->numberOfRenderingConnections(r); ++j) 
			{
                auto connectedOutput = input->renderingOutput(r, j);
                AudioNode* connectedNode = connectedOutput->node();
                notifyAudioSourcesConnectedToNode(r, connectedNode); // recurse
            }
        }
    }
}
开发者ID:eswartz,项目名称:LabSound,代码行数:29,代码来源:PannerNode.cpp

示例5: loopEndAttrSetter

static void loopEndAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
    AudioBufferSourceNode* imp = V8AudioBufferSourceNode::toNative(info.Holder());
    double v = static_cast<double>(value->NumberValue());
    imp->setLoopEnd(v);
    return;
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:7,代码来源:V8AudioBufferSourceNode.cpp

示例6: FindConnectedSources

void
PannerNode::FindConnectedSources(AudioNode* aNode,
                                 nsTArray<AudioBufferSourceNode*>& aSources,
                                 std::set<AudioNode*>& aNodesSeen)
{
  if (!aNode) {
    return;
  }

  const nsTArray<InputNode>& inputNodes = aNode->InputNodes();

  for(unsigned i = 0; i < inputNodes.Length(); i++) {
    // Return if we find a node that we have seen already.
    if (aNodesSeen.find(inputNodes[i].mInputNode) != aNodesSeen.end()) {
      return;
    }
    aNodesSeen.insert(inputNodes[i].mInputNode);
    // Recurse
    FindConnectedSources(inputNodes[i].mInputNode, aSources, aNodesSeen);

    // Check if this node is an AudioBufferSourceNode that still have a stream,
    // which means it has not finished playing.
    AudioBufferSourceNode* node = inputNodes[i].mInputNode->AsAudioBufferSourceNode();
    if (node && node->GetStream()) {
      aSources.AppendElement(node);
    }
  }
}
开发者ID:paulmadore,项目名称:luckyde,代码行数:28,代码来源:PannerNode.cpp

示例7: jsAudioBufferSourceNodePlaybackRate

JSValue jsAudioBufferSourceNodePlaybackRate(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSAudioBufferSourceNode* castedThis = static_cast<JSAudioBufferSourceNode*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    AudioBufferSourceNode* imp = static_cast<AudioBufferSourceNode*>(castedThis->impl());
    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->playbackRate()));
    return result;
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:8,代码来源:JSAudioBufferSourceNode.cpp

示例8: jsAudioBufferSourceNodeLooping

JSValue jsAudioBufferSourceNodeLooping(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSAudioBufferSourceNode* castedThis = static_cast<JSAudioBufferSourceNode*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    AudioBufferSourceNode* imp = static_cast<AudioBufferSourceNode*>(castedThis->impl());
    JSValue result = jsBoolean(imp->looping());
    return result;
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:8,代码来源:JSAudioBufferSourceNode.cpp

示例9: noteOffCallback

static v8::Handle<v8::Value> noteOffCallback(const v8::Arguments& args)
{
    if (args.Length() < 1)
        return throwNotEnoughArgumentsError(args.GetIsolate());
    AudioBufferSourceNode* imp = V8AudioBufferSourceNode::toNative(args.Holder());
    V8TRYCATCH(double, when, static_cast<double>(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)->NumberValue()));
    imp->noteOff(when);
    return v8Undefined();
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:9,代码来源:V8AudioBufferSourceNode.cpp

示例10: noteOnCallback

static v8::Handle<v8::Value> noteOnCallback(const v8::Arguments& args)
{
    FeatureObserver::observe(activeDOMWindow(BindingState::instance()), FeatureObserver::LegacyWebAudio);
    if (args.Length() < 1)
        return throwNotEnoughArgumentsError(args.GetIsolate());
    AudioBufferSourceNode* imp = V8AudioBufferSourceNode::toNative(args.Holder());
    V8TRYCATCH(double, when, static_cast<double>(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)->NumberValue()));
    imp->noteOn(when);
    return v8Undefined();
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:10,代码来源:V8AudioBufferSourceNode.cpp

示例11: playbackRateAttrGetter

static v8::Handle<v8::Value> playbackRateAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    AudioBufferSourceNode* imp = V8AudioBufferSourceNode::toNative(info.Holder());
    RefPtr<AudioParam> result = imp->playbackRate();
    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(), "playbackRate", wrapper);
    }
    return wrapper;
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:12,代码来源:V8AudioBufferSourceNode.cpp

示例12: ASSERT

void AbstractAudioContext::handleStoppableSourceNodes()
{
    ASSERT(isGraphOwner());

    // Find AudioBufferSourceNodes to see if we can stop playing them.
    for (AudioNode* node : m_activeSourceNodes) {
        if (node->handler().nodeType() == AudioHandler::NodeTypeAudioBufferSource) {
            AudioBufferSourceNode* sourceNode = static_cast<AudioBufferSourceNode*>(node);
            sourceNode->audioBufferSourceHandler().handleStoppableSourceNode();
        }
    }
}
开发者ID:smishenk,项目名称:chromium-crosswalk,代码行数:12,代码来源:AbstractAudioContext.cpp

示例13: setBuffer

void JSAudioBufferSourceNode::setBuffer(ExecState* exec, JSValue value)
{
    AudioBufferSourceNode* imp = static_cast<AudioBufferSourceNode*>(impl());
    AudioBuffer* buffer = toAudioBuffer(value);
    if (!buffer) {
        throwError(exec, createSyntaxError(exec, "Value is not of type AudioBuffer"));
        return;
    }
    
    if (!imp->setBuffer(buffer))
        throwError(exec, createSyntaxError(exec, "AudioBuffer unsupported number of channels"));
}
开发者ID:CannedFish,项目名称:deepin-webkit,代码行数:12,代码来源:JSAudioBufferSourceNodeCustom.cpp

示例14: ASSERT

void AudioContext::handleStoppableSourceNodes()
{
    ASSERT(isGraphOwner());

    // Find AudioBufferSourceNodes to see if we can stop playing them.
    for (unsigned i = 0; i < m_referencedNodes.size(); ++i) {
        AudioNode* node = m_referencedNodes.at(i).get();

        if (node->handler().nodeType() == AudioHandler::NodeTypeAudioBufferSource) {
            AudioBufferSourceNode* sourceNode = static_cast<AudioBufferSourceNode*>(node);
            sourceNode->audioBufferSourceHandler().handleStoppableSourceNode();
        }
    }
}
开发者ID:kingysu,项目名称:blink-crosswalk,代码行数:14,代码来源:AudioContext.cpp

示例15: jsAudioBufferSourceNodePrototypeFunctionNoteOff

EncodedJSValue JSC_HOST_CALL jsAudioBufferSourceNodePrototypeFunctionNoteOff(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSAudioBufferSourceNode::s_info))
        return throwVMTypeError(exec);
    JSAudioBufferSourceNode* castedThis = static_cast<JSAudioBufferSourceNode*>(asObject(thisValue));
    ASSERT_GC_OBJECT_INHERITS(castedThis, &JSAudioBufferSourceNode::s_info);
    AudioBufferSourceNode* imp = static_cast<AudioBufferSourceNode*>(castedThis->impl());
    if (exec->argumentCount() < 1)
        return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
    float when(exec->argument(0).toFloat(exec));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());

    imp->noteOff(when);
    return JSValue::encode(jsUndefined());
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:17,代码来源:JSAudioBufferSourceNode.cpp


注:本文中的AudioBufferSourceNode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。