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


C++ AudioNodeOutput类代码示例

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


在下文中一共展示了AudioNodeOutput类的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

bool AudioNode::connect(AudioNode* destination, unsigned outputIndex, unsigned inputIndex)
{
    ASSERT(isMainThread()); 
    AudioContext::AutoLocker locker(context());
    
    // Sanity check input and output indices.
    if (outputIndex >= numberOfOutputs())
        return false;
    if (destination && inputIndex >= destination->numberOfInputs())
        return false;

    AudioNodeOutput* output = this->output(outputIndex);
    if (!destination) {
        // Disconnect output from any inputs it may be currently connected to.
        output->disconnectAllInputs();
        return true;
    }
    
    if (context() != destination->context())
        return false;

    AudioNodeInput* input = destination->input(inputIndex);
    input->connect(output);

    // Let context know that a connection has been made.
    context()->incrementConnectionCount();

    return true;
}
开发者ID:,项目名称:,代码行数:29,代码来源:

示例3: ASSERT

AudioBus* AudioNodeInput::pull(AudioBus* inPlaceBus, size_t framesToProcess)
{
    ASSERT(context()->isAudioThread());

    // Handle single connection case.
    if (numberOfRenderingConnections() == 1 && node()->internalChannelCountMode() == AudioNode::Max) {
        // The output will optimize processing using inPlaceBus if it's able.
        AudioNodeOutput* output = this->renderingOutput(0);
        return output->pull(inPlaceBus, framesToProcess);
    }

    AudioBus* internalSummingBus = this->internalSummingBus();

    if (!numberOfRenderingConnections()) {
        // At least, generate silence if we're not connected to anything.
        // FIXME: if we wanted to get fancy, we could propagate a 'silent hint' here to optimize the downstream graph processing.
        internalSummingBus->zero();
        return internalSummingBus;
    }

    // Handle multiple connections case.
    sumAllConnections(internalSummingBus, framesToProcess);
    
    return internalSummingBus;
}
开发者ID:webOS-ports,项目名称:webkit,代码行数:25,代码来源:AudioNodeInput.cpp

示例4: ASSERT

// Any time a connection or disconnection happens on any of our inputs, we potentially need to change the
// number of channels of our output.
void ChannelMergerNode::checkNumberOfChannelsForInput(AudioNodeInput* input)
{
    ASSERT(context()->isAudioThread() && context()->isGraphOwner());

    // Count how many channels we have all together from all of the inputs.
    unsigned numberOfOutputChannels = 0;
    for (unsigned i = 0; i < numberOfInputs(); ++i) {
        AudioNodeInput* input = this->input(i);
        if (input->isConnected())
            numberOfOutputChannels += input->numberOfChannels();
    }

    // If the actual number of channels exceeds the max allowed, just drop the excess.
    numberOfOutputChannels = std::min(numberOfOutputChannels, AudioContext::maxNumberOfChannels());

    // Set the correct number of channels on the output
    AudioNodeOutput* output = this->output(0);
    ASSERT(output);
    output->setNumberOfChannels(numberOfOutputChannels);
    // There can in rare cases be a slight delay before the output bus is updated to the new number of
    // channels because of tryLocks() in the context's updating system. So record the new number of
    // output channels here.
    m_desiredNumberOfOutputChannels = numberOfOutputChannels;

    AudioNode::checkNumberOfChannelsForInput(input);
}
开发者ID:335969568,项目名称:Blink-1,代码行数:28,代码来源:ChannelMergerNode.cpp

示例5: 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

示例6: process

void AudioChannelMerger::process(size_t framesToProcess)
{
    AudioNodeOutput* output = this->output(0);
    ASSERT(output);
    ASSERT_UNUSED(framesToProcess, framesToProcess == output->bus()->length());    
    
    // Merge all the channels from all the inputs into one output.
    unsigned outputChannelIndex = 0;
    for (unsigned i = 0; i < numberOfInputs(); ++i) {
        AudioNodeInput* input = this->input(i);
        if (input->isConnected()) {
            unsigned numberOfInputChannels = input->bus()->numberOfChannels();
            
            // Merge channels from this particular input.
            for (unsigned j = 0; j < numberOfInputChannels; ++j) {
                AudioChannel* inputChannel = input->bus()->channel(j);
                AudioChannel* outputChannel = output->bus()->channel(outputChannelIndex);
                outputChannel->copyFrom(inputChannel);
                
                ++outputChannelIndex;
            }
        }
    }
    
    ASSERT(outputChannelIndex == output->numberOfChannels());
}
开发者ID:1833183060,项目名称:wke,代码行数:26,代码来源:AudioChannelMerger.cpp

示例7: numberOfChannels

unsigned AudioNodeInput::numberOfChannels() const
{
    // Find the number of channels of the connection with the largest number of channels.
    unsigned maxChannels = 1; // one channel is the minimum allowed

    for (HashSet<AudioNodeOutput*>::iterator i = m_outputs.begin(); i != m_outputs.end(); ++i) {
        AudioNodeOutput* output = *i;
        maxChannels = max(maxChannels, output->bus()->numberOfChannels());
    }
    
    return maxChannels;
}
开发者ID:1833183060,项目名称:wke,代码行数:12,代码来源:AudioNodeInput.cpp

示例8: ASSERT

void AudioNode::disconnect(unsigned outputIndex, ExceptionState& exceptionState)
{
    ASSERT(isMainThread());
    AudioContext::AutoLocker locker(context());

    // Sanity check input and output indices.
    if (outputIndex >= numberOfOutputs()) {
        exceptionState.throwDOMException(
            IndexSizeError,
            "output index (" + String::number(outputIndex) + ") exceeds number of outputs (" + String::number(numberOfOutputs()) + ").");
        return;
    }

    AudioNodeOutput* output = this->output(outputIndex);
    output->disconnectAll();
}
开发者ID:coinpayee,项目名称:blink,代码行数:16,代码来源:AudioNode.cpp

示例9: ASSERT

// Any time a connection or disconnection happens on any of our inputs, we potentially need to change the
// number of channels of our output.
void AudioChannelMerger::checkNumberOfChannelsForInput(AudioNodeInput*)
{
    ASSERT(context()->isAudioThread() && context()->isGraphOwner());

    // Count how many channels we have all together from all of the inputs.
    unsigned numberOfOutputChannels = 0;
    for (unsigned i = 0; i < numberOfInputs(); ++i) {
        AudioNodeInput* input = this->input(i);
        if (input->isConnected())
            numberOfOutputChannels += input->bus()->numberOfChannels();
    }

    // Set the correct number of channels on the output
    AudioNodeOutput* output = this->output(0);
    ASSERT(output);
    output->setNumberOfChannels(numberOfOutputChannels);
}
开发者ID:1833183060,项目名称:wke,代码行数:19,代码来源:AudioChannelMerger.cpp

示例10: ASSERT

void AudioSummingJunction::updateRenderingState()
{
    ASSERT(context()->isAudioThread() && context()->isGraphOwner());
    if (m_renderingStateNeedUpdating) {
        // Copy from m_outputs to m_renderingOutputs.
        m_renderingOutputs.resize(m_outputs.size());
        unsigned j = 0;
        for (HashSet<AudioNodeOutput*>::iterator i = m_outputs.begin(); i != m_outputs.end(); ++i, ++j) {
            AudioNodeOutput* output = *i;
            m_renderingOutputs[j] = output;
            output->updateRenderingState();
        }

        didUpdate();

        m_renderingStateNeedUpdating = false;
    }
}
开发者ID:335969568,项目名称:Blink-1,代码行数:18,代码来源:AudioSummingJunction.cpp

示例11: disconnect

void AudioParamHandler::disconnect(AudioNodeOutput& output)
{
    ASSERT(deferredTaskHandler().isGraphOwner());

    if (m_outputs.contains(&output)) {
        m_outputs.remove(&output);
        changedOutputs();
        output.removeParam(*this);
    }
}
开发者ID:alexanderbill,项目名称:blink-crosswalk,代码行数:10,代码来源:AudioParam.cpp

示例12: ASSERT

void AudioNodeInput::updateRenderingState()
{
    ASSERT(context()->isAudioThread() && context()->isGraphOwner());
    
    if (m_renderingStateNeedUpdating && !node()->isMarkedForDeletion()) {
        // Copy from m_outputs to m_renderingOutputs.
        m_renderingOutputs.resize(m_outputs.size());
        unsigned j = 0;
        for (HashSet<AudioNodeOutput*>::iterator i = m_outputs.begin(); i != m_outputs.end(); ++i, ++j) {
            AudioNodeOutput* output = *i;
            m_renderingOutputs[j] = output;
            output->updateRenderingState();
        }

        node()->checkNumberOfChannelsForInput(this);
        
        m_renderingStateNeedUpdating = false;
    }
}
开发者ID:1833183060,项目名称:wke,代码行数:19,代码来源:AudioNodeInput.cpp

示例13: connect

void AudioNodeInput::connect(AudioNodeOutput& output) {
  ASSERT(deferredTaskHandler().isGraphOwner());

  // Check if we're already connected to this output.
  if (m_outputs.contains(&output))
    return;

  output.addInput(*this);
  m_outputs.add(&output);
  changedOutputs();
}
开发者ID:mirror,项目名称:chromium,代码行数:11,代码来源:AudioNodeInput.cpp

示例14: connect

void AudioParamHandler::connect(AudioNodeOutput& output)
{
    ASSERT(deferredTaskHandler().isGraphOwner());

    if (m_outputs.contains(&output))
        return;

    output.addParam(*this);
    m_outputs.add(&output);
    changedOutputs();
}
开发者ID:alexanderbill,项目名称:blink-crosswalk,代码行数:11,代码来源:AudioParam.cpp

示例15: node

unsigned AudioNodeInput::numberOfChannels() const
{
    AudioNode::ChannelCountMode mode = node()->internalChannelCountMode();
    if (mode == AudioNode::Explicit)
        return node()->channelCount();

    // Find the number of channels of the connection with the largest number of channels.
    unsigned maxChannels = 1; // one channel is the minimum allowed

    for (HashSet<AudioNodeOutput*>::iterator i = m_outputs.begin(); i != m_outputs.end(); ++i) {
        AudioNodeOutput* output = *i;
        // Use output()->numberOfChannels() instead of output->bus()->numberOfChannels(),
        // because the calling of AudioNodeOutput::bus() is not safe here.
        maxChannels = max(maxChannels, output->numberOfChannels());
    }

    if (mode == AudioNode::ClampedMax)
        maxChannels = min(maxChannels, static_cast<unsigned>(node()->channelCount()));

    return maxChannels;
}
开发者ID:webOS-ports,项目名称:webkit,代码行数:21,代码来源:AudioNodeInput.cpp


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