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

Side by Side Diff: Source/platform/audio/Distance.cpp

Issue 511333002: Removing "using" declarations that import names in the C++ Standard library.(Source/platform/audio) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 18 matching lines...) Expand all
29 #include "config.h" 29 #include "config.h"
30 30
31 #if ENABLE(WEB_AUDIO) 31 #if ENABLE(WEB_AUDIO)
32 32
33 #include "platform/audio/Distance.h" 33 #include "platform/audio/Distance.h"
34 #include "wtf/Assertions.h" 34 #include "wtf/Assertions.h"
35 35
36 #include <math.h> 36 #include <math.h>
37 #include <algorithm> 37 #include <algorithm>
38 38
39 using namespace std;
40
41 namespace blink { 39 namespace blink {
42 40
43 DistanceEffect::DistanceEffect() 41 DistanceEffect::DistanceEffect()
44 : m_model(ModelInverse) 42 : m_model(ModelInverse)
45 , m_isClamped(true) 43 , m_isClamped(true)
46 , m_refDistance(1.0) 44 , m_refDistance(1.0)
47 , m_maxDistance(10000.0) 45 , m_maxDistance(10000.0)
48 , m_rolloffFactor(1.0) 46 , m_rolloffFactor(1.0)
49 { 47 {
50 } 48 }
51 49
52 double DistanceEffect::gain(double distance) 50 double DistanceEffect::gain(double distance)
53 { 51 {
54 // don't go beyond maximum distance 52 // don't go beyond maximum distance
55 distance = min(distance, m_maxDistance); 53 distance = std::min(distance, m_maxDistance);
56 54
57 // if clamped, don't get closer than reference distance 55 // if clamped, don't get closer than reference distance
58 if (m_isClamped) 56 if (m_isClamped)
59 distance = max(distance, m_refDistance); 57 distance = std::max(distance, m_refDistance);
60 58
61 switch (m_model) { 59 switch (m_model) {
62 case ModelLinear: 60 case ModelLinear:
63 return linearGain(distance); 61 return linearGain(distance);
64 case ModelInverse: 62 case ModelInverse:
65 return inverseGain(distance); 63 return inverseGain(distance);
66 case ModelExponential: 64 case ModelExponential:
67 return exponentialGain(distance); 65 return exponentialGain(distance);
68 } 66 }
69 ASSERT_NOT_REACHED(); 67 ASSERT_NOT_REACHED();
(...skipping 13 matching lines...) Expand all
83 } 81 }
84 82
85 double DistanceEffect::exponentialGain(double distance) 83 double DistanceEffect::exponentialGain(double distance)
86 { 84 {
87 return pow(distance / m_refDistance, -m_rolloffFactor); 85 return pow(distance / m_refDistance, -m_rolloffFactor);
88 } 86 }
89 87
90 } // namespace blink 88 } // namespace blink
91 89
92 #endif // ENABLE(WEB_AUDIO) 90 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « Source/platform/audio/AudioResamplerKernel.cpp ('k') | Source/platform/audio/DynamicsCompressorKernel.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698