This source file includes following definitions.
- m_needAutomaticPull
- pullInputs
- connect
- disconnect
- checkNumberOfChannelsForInput
- updatePullStatus
#include "config.h"
#if ENABLE(WEB_AUDIO)
#include "modules/webaudio/AudioBasicInspectorNode.h"
#include "modules/webaudio/AudioContext.h"
#include "modules/webaudio/AudioNodeInput.h"
#include "modules/webaudio/AudioNodeOutput.h"
namespace WebCore {
AudioBasicInspectorNode::AudioBasicInspectorNode(AudioContext* context, float sampleRate, unsigned outputChannelCount)
: AudioNode(context, sampleRate)
, m_needAutomaticPull(false)
{
addInput(adoptPtr(new AudioNodeInput(this)));
addOutput(adoptPtr(new AudioNodeOutput(this, outputChannelCount)));
}
void AudioBasicInspectorNode::pullInputs(size_t framesToProcess)
{
input(0)->pull(output(0)->bus(), framesToProcess);
}
void AudioBasicInspectorNode::connect(AudioNode* destination, unsigned outputIndex, unsigned inputIndex, ExceptionState& exceptionState)
{
ASSERT(isMainThread());
AudioContext::AutoLocker locker(context());
AudioNode::connect(destination, outputIndex, inputIndex, exceptionState);
updatePullStatus();
}
void AudioBasicInspectorNode::disconnect(unsigned outputIndex, ExceptionState& exceptionState)
{
ASSERT(isMainThread());
AudioContext::AutoLocker locker(context());
AudioNode::disconnect(outputIndex, exceptionState);
updatePullStatus();
}
void AudioBasicInspectorNode::checkNumberOfChannelsForInput(AudioNodeInput* input)
{
ASSERT(context()->isAudioThread() && context()->isGraphOwner());
ASSERT(input == this->input(0));
if (input != this->input(0))
return;
unsigned numberOfChannels = input->numberOfChannels();
if (numberOfChannels != output(0)->numberOfChannels()) {
output(0)->setNumberOfChannels(numberOfChannels);
}
AudioNode::checkNumberOfChannelsForInput(input);
updatePullStatus();
}
void AudioBasicInspectorNode::updatePullStatus()
{
ASSERT(context()->isGraphOwner());
if (output(0)->isConnected()) {
if (m_needAutomaticPull) {
context()->removeAutomaticPullNode(this);
m_needAutomaticPull = false;
}
} else {
unsigned numberOfInputConnections = input(0)->numberOfRenderingConnections();
if (numberOfInputConnections && !m_needAutomaticPull) {
context()->addAutomaticPullNode(this);
m_needAutomaticPull = true;
} else if (!numberOfInputConnections && m_needAutomaticPull) {
context()->removeAutomaticPullNode(this);
m_needAutomaticPull = false;
}
}
}
}
#endif