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

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

Issue 170453004: Add constant twoPiDouble/twoPiFloat to MathExtras.h (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add constant values to header Created 6 years, 10 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
« no previous file with comments | « Source/platform/audio/DynamicsCompressorKernel.cpp ('k') | Source/platform/audio/FFTFrame.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // sourceL -> destL and "equal-power pan" sourceR as in mono case 94 // sourceL -> destL and "equal-power pan" sourceR as in mono case
95 // by transforming the "azimuth" value from -90 -> 0 degrees into th e range -90 -> +90. 95 // by transforming the "azimuth" value from -90 -> 0 degrees into th e range -90 -> +90.
96 desiredPanPosition = (azimuth + 90) / 90; 96 desiredPanPosition = (azimuth + 90) / 90;
97 } else { // from 0 -> +90 97 } else { // from 0 -> +90
98 // sourceR -> destR and "equal-power pan" sourceL as in mono case 98 // sourceR -> destR and "equal-power pan" sourceL as in mono case
99 // by transforming the "azimuth" value from 0 -> +90 degrees into th e range -90 -> +90. 99 // by transforming the "azimuth" value from 0 -> +90 degrees into th e range -90 -> +90.
100 desiredPanPosition = azimuth / 90; 100 desiredPanPosition = azimuth / 90;
101 } 101 }
102 } 102 }
103 103
104 desiredGainL = cos(0.5 * piDouble * desiredPanPosition); 104 desiredGainL = cos(piOverTwoDouble * desiredPanPosition);
105 desiredGainR = sin(0.5 * piDouble * desiredPanPosition); 105 desiredGainR = sin(piOverTwoDouble * desiredPanPosition);
106 106
107 // Don't de-zipper on first render call. 107 // Don't de-zipper on first render call.
108 if (m_isFirstRender) { 108 if (m_isFirstRender) {
109 m_isFirstRender = false; 109 m_isFirstRender = false;
110 m_gainL = desiredGainL; 110 m_gainL = desiredGainL;
111 m_gainR = desiredGainR; 111 m_gainR = desiredGainR;
112 } 112 }
113 113
114 // Cache in local variables. 114 // Cache in local variables.
115 double gainL = m_gainL; 115 double gainL = m_gainL;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 } 150 }
151 } 151 }
152 152
153 m_gainL = gainL; 153 m_gainL = gainL;
154 m_gainR = gainR; 154 m_gainR = gainR;
155 } 155 }
156 156
157 } // namespace WebCore 157 } // namespace WebCore
158 158
159 #endif // ENABLE(WEB_AUDIO) 159 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « Source/platform/audio/DynamicsCompressorKernel.cpp ('k') | Source/platform/audio/FFTFrame.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698