Title: [111100] trunk/Source/WebCore
- Revision
- 111100
- Author
- [email protected]
- Date
- 2012-03-16 17:49:27 -0700 (Fri, 16 Mar 2012)
Log Message
Account for sample-rate in convolution normalization
https://bugs.webkit.org/show_bug.cgi?id=81432
Reviewed by James Robinson.
* platform/audio/Reverb.cpp:
(WebCore):
(WebCore::calculateNormalizationScale):
* webaudio/ConvolverNode.cpp:
(WebCore::ConvolverNode::setBuffer):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (111099 => 111100)
--- trunk/Source/WebCore/ChangeLog 2012-03-17 00:41:19 UTC (rev 111099)
+++ trunk/Source/WebCore/ChangeLog 2012-03-17 00:49:27 UTC (rev 111100)
@@ -1,3 +1,16 @@
+2012-03-16 Chris Rogers <[email protected]>
+
+ Account for sample-rate in convolution normalization
+ https://bugs.webkit.org/show_bug.cgi?id=81432
+
+ Reviewed by James Robinson.
+
+ * platform/audio/Reverb.cpp:
+ (WebCore):
+ (WebCore::calculateNormalizationScale):
+ * webaudio/ConvolverNode.cpp:
+ (WebCore::ConvolverNode::setBuffer):
+
2012-03-16 Tom Sepez <[email protected]>
Make V8 window.open.call(), window.open.showModalDialog() results more closely match JSC.
Modified: trunk/Source/WebCore/platform/audio/Reverb.cpp (111099 => 111100)
--- trunk/Source/WebCore/platform/audio/Reverb.cpp 2012-03-17 00:41:19 UTC (rev 111099)
+++ trunk/Source/WebCore/platform/audio/Reverb.cpp 2012-03-17 00:49:27 UTC (rev 111100)
@@ -51,6 +51,7 @@
// Empirical gain calibration tested across many impulse responses to ensure perceived volume is same as dry (unprocessed) signal
const float GainCalibration = -58;
+const float GainCalibrationSampleRate = 44100;
// A minimum power value to when normalizing a silent (or very quiet) impulse response
const float MinPower = 0.000125f;
@@ -79,6 +80,10 @@
scale *= powf(10, GainCalibration * 0.05f); // calibrate to make perceived volume same as unprocessed
+ // Scale depends on sample-rate.
+ if (response->sampleRate())
+ scale *= GainCalibrationSampleRate / response->sampleRate();
+
// True-stereo compensation
if (response->numberOfChannels() == 4)
scale *= 0.5f;
Modified: trunk/Source/WebCore/webaudio/ConvolverNode.cpp (111099 => 111100)
--- trunk/Source/WebCore/webaudio/ConvolverNode.cpp 2012-03-17 00:41:19 UTC (rev 111099)
+++ trunk/Source/WebCore/webaudio/ConvolverNode.cpp 2012-03-17 00:49:27 UTC (rev 111100)
@@ -132,7 +132,9 @@
AudioBus bufferBus(numberOfChannels, bufferLength, false);
for (unsigned i = 0; i < numberOfChannels; ++i)
bufferBus.setChannelMemory(i, buffer->getChannelData(i)->data(), bufferLength);
-
+
+ bufferBus.setSampleRate(buffer->sampleRate());
+
// Create the reverb with the given impulse response.
bool useBackgroundThreads = !context()->isOfflineContext();
OwnPtr<Reverb> reverb = adoptPtr(new Reverb(&bufferBus, AudioNode::ProcessingSizeInFrames, MaxFFTSize, 2, useBackgroundThreads, m_normalize));
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes