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

Side by Side Diff: Source/modules/webaudio/PannerNode.cpp

Issue 363613003: Removing using declarations that import names in the C++ Standard library. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 months 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010, Google Inc. All rights reserved. 2 * Copyright (C) 2010, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 18 matching lines...) Expand all
29 #include "modules/webaudio/PannerNode.h" 29 #include "modules/webaudio/PannerNode.h"
30 30
31 #include "core/dom/ExecutionContext.h" 31 #include "core/dom/ExecutionContext.h"
32 #include "platform/audio/HRTFPanner.h" 32 #include "platform/audio/HRTFPanner.h"
33 #include "modules/webaudio/AudioBufferSourceNode.h" 33 #include "modules/webaudio/AudioBufferSourceNode.h"
34 #include "modules/webaudio/AudioContext.h" 34 #include "modules/webaudio/AudioContext.h"
35 #include "modules/webaudio/AudioNodeInput.h" 35 #include "modules/webaudio/AudioNodeInput.h"
36 #include "modules/webaudio/AudioNodeOutput.h" 36 #include "modules/webaudio/AudioNodeOutput.h"
37 #include "wtf/MathExtras.h" 37 #include "wtf/MathExtras.h"
38 38
39 using namespace std;
40
41 namespace WebCore { 39 namespace WebCore {
42 40
43 static void fixNANs(double &x) 41 static void fixNANs(double &x)
44 { 42 {
45 if (std::isnan(x) || std::isinf(x)) 43 if (std::isnan(x) || std::isinf(x))
46 x = 0.0; 44 x = 0.0;
47 } 45 }
48 46
49 PannerNode::PannerNode(AudioContext* context, float sampleRate) 47 PannerNode::PannerNode(AudioContext* context, float sampleRate)
50 : AudioNode(context, sampleRate) 48 : AudioNode(context, sampleRate)
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 // shift, and just return the cached value. 458 // shift, and just return the cached value.
461 dopplerShift = m_cachedDopplerRate; 459 dopplerShift = m_cachedDopplerRate;
462 } else { 460 } else {
463 double listenerProjection = sourceToListener.dot(listenerVelocit y) / sourceListenerMagnitude; 461 double listenerProjection = sourceToListener.dot(listenerVelocit y) / sourceListenerMagnitude;
464 double sourceProjection = sourceToListener.dot(sourceVelocity) / sourceListenerMagnitude; 462 double sourceProjection = sourceToListener.dot(sourceVelocity) / sourceListenerMagnitude;
465 463
466 listenerProjection = -listenerProjection; 464 listenerProjection = -listenerProjection;
467 sourceProjection = -sourceProjection; 465 sourceProjection = -sourceProjection;
468 466
469 double scaledSpeedOfSound = speedOfSound / dopplerFactor; 467 double scaledSpeedOfSound = speedOfSound / dopplerFactor;
470 listenerProjection = min(listenerProjection, scaledSpeedOfSound) ; 468 listenerProjection = std::min(listenerProjection, scaledSpeedOfS ound);
471 sourceProjection = min(sourceProjection, scaledSpeedOfSound); 469 sourceProjection = std::min(sourceProjection, scaledSpeedOfSound );
472 470
473 dopplerShift = ((speedOfSound - dopplerFactor * listenerProjecti on) / (speedOfSound - dopplerFactor * sourceProjection)); 471 dopplerShift = ((speedOfSound - dopplerFactor * listenerProjecti on) / (speedOfSound - dopplerFactor * sourceProjection));
474 fixNANs(dopplerShift); // avoid illegal values 472 fixNANs(dopplerShift); // avoid illegal values
475 473
476 // Limit the pitch shifting to 4 octaves up and 3 octaves down. 474 // Limit the pitch shifting to 4 octaves up and 3 octaves down.
477 if (dopplerShift > 16.0) 475 if (dopplerShift > 16.0)
478 dopplerShift = 16.0; 476 dopplerShift = 16.0;
479 else if (dopplerShift < 0.125) 477 else if (dopplerShift < 0.125)
480 dopplerShift = 0.125; 478 dopplerShift = 0.125;
481 } 479 }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 notifyAudioSourcesConnectedToNode(connectedNode, visitedNode s); // recurse 571 notifyAudioSourcesConnectedToNode(connectedNode, visitedNode s); // recurse
574 } 572 }
575 } 573 }
576 } 574 }
577 } 575 }
578 } 576 }
579 577
580 } // namespace WebCore 578 } // namespace WebCore
581 579
582 #endif // ENABLE(WEB_AUDIO) 580 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « Source/modules/webaudio/OscillatorNode.cpp ('k') | Source/modules/webaudio/RealtimeAnalyser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698