Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Unified Diff: Source/modules/webaudio/PannerNode.cpp

Issue 783273002: Remove Doppler effect from PannerNode (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/webaudio/PannerNode.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/webaudio/PannerNode.cpp
diff --git a/Source/modules/webaudio/PannerNode.cpp b/Source/modules/webaudio/PannerNode.cpp
index e472cc7df87eb5a9c4041c77b85fbc4904e03eeb..ade66d5acc89ec50396101ee85b92c8993a9788e 100644
--- a/Source/modules/webaudio/PannerNode.cpp
+++ b/Source/modules/webaudio/PannerNode.cpp
@@ -62,7 +62,6 @@ PannerNode::PannerNode(AudioContext* context, float sampleRate)
, m_cachedElevation(0)
, m_cachedDistanceConeGain(1.0f)
, m_cachedDopplerRate(1)
- , m_connectionCount(0)
{
// Load the HRTF database asynchronously so we don't block the Javascript thread while creating the HRTF database.
// The HRTF panner will return zeroes until the database is loaded.
@@ -92,24 +91,6 @@ void PannerNode::dispose()
AudioNode::dispose();
}
-void PannerNode::pullInputs(size_t framesToProcess)
-{
- // We override pullInputs(), so we can detect new AudioSourceNodes which have connected to us when new connections are made.
- // These AudioSourceNodes need to be made aware of our existence in order to handle doppler shift pitch changes.
- if (m_connectionCount != context()->connectionCount()) {
- m_connectionCount = context()->connectionCount();
-
- // A map for keeping track if we have visited a node or not. This prevents feedback loops
- // from recursing infinitely. See crbug.com/331446.
- HashMap<AudioNode*, bool> visitedNodes;
-
- // Recursively go through all nodes connected to us
- notifyAudioSourcesConnectedToNode(this, visitedNodes);
- }
-
- AudioNode::pullInputs(framesToProcess);
-}
-
void PannerNode::process(size_t framesToProcess)
{
AudioBus* destination = output(0)->bus();
@@ -550,38 +531,6 @@ void PannerNode::markPannerAsDirty(unsigned dirty)
m_isDopplerRateDirty = true;
}
-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
- }
- }
- }
- }
-}
-
void PannerNode::setChannelCount(unsigned long channelCount, ExceptionState& exceptionState)
{
ASSERT(isMainThread());
« no previous file with comments | « Source/modules/webaudio/PannerNode.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698