Precision updates in WebAudio.

https://bugs.webkit.org/show_bug.cgi?id=119739

Patch by Praveen R Jadhav <praveen.j@samsung.com> on 2013-09-05
Reviewed by Philippe Normand.

WebAudio Specification suggests to use 'double' datatypes
for minDecibels, maxDecibels and smoothingTimeConstant in
AnalyserNode.idl and currentTime in AudioContext.idl.
Current WebKit implementation has declared these attributes
as 'float' type.

Spec: https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#AudioContext-section
      https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#AnalyserNode

No new tests, covered by existing tests.

* Modules/webaudio/AnalyserNode.cpp:
(WebCore::AnalyserNode::setMinDecibels):
(WebCore::AnalyserNode::setMaxDecibels):
(WebCore::AnalyserNode::setSmoothingTimeConstant):
* Modules/webaudio/AnalyserNode.h:
(WebCore::AnalyserNode::minDecibels):
(WebCore::AnalyserNode::maxDecibels):
(WebCore::AnalyserNode::smoothingTimeConstant):
* Modules/webaudio/AnalyserNode.idl:
* Modules/webaudio/AudioContext.idl:
* Modules/webaudio/RealtimeAnalyser.h:
(WebCore::RealtimeAnalyser::setMinDecibels):
(WebCore::RealtimeAnalyser::minDecibels):
(WebCore::RealtimeAnalyser::setMaxDecibels):
(WebCore::RealtimeAnalyser::maxDecibels):
(WebCore::RealtimeAnalyser::setSmoothingTimeConstant):
(WebCore::RealtimeAnalyser::smoothingTimeConstant):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155112 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 896ad3b6
2013-09-05 Praveen R Jadhav <praveen.j@samsung.com>
Precision updates in WebAudio.
https://bugs.webkit.org/show_bug.cgi?id=119739
Reviewed by Philippe Normand.
WebAudio Specification suggests to use 'double' datatypes
for minDecibels, maxDecibels and smoothingTimeConstant in
AnalyserNode.idl and currentTime in AudioContext.idl.
Current WebKit implementation has declared these attributes
as 'float' type.
Spec: https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#AudioContext-section
https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#AnalyserNode
No new tests, covered by existing tests.
* Modules/webaudio/AnalyserNode.cpp:
(WebCore::AnalyserNode::setMinDecibels):
(WebCore::AnalyserNode::setMaxDecibels):
(WebCore::AnalyserNode::setSmoothingTimeConstant):
* Modules/webaudio/AnalyserNode.h:
(WebCore::AnalyserNode::minDecibels):
(WebCore::AnalyserNode::maxDecibels):
(WebCore::AnalyserNode::smoothingTimeConstant):
* Modules/webaudio/AnalyserNode.idl:
* Modules/webaudio/AudioContext.idl:
* Modules/webaudio/RealtimeAnalyser.h:
(WebCore::RealtimeAnalyser::setMinDecibels):
(WebCore::RealtimeAnalyser::minDecibels):
(WebCore::RealtimeAnalyser::setMaxDecibels):
(WebCore::RealtimeAnalyser::maxDecibels):
(WebCore::RealtimeAnalyser::setSmoothingTimeConstant):
(WebCore::RealtimeAnalyser::smoothingTimeConstant):
2013-09-05 Mihnea Ovidenie <mihnea@adobe.com>
Replace node() calls with generatingNode() for RenderRegion code
......@@ -78,7 +78,7 @@ void AnalyserNode::setFftSize(unsigned size, ExceptionCode& ec)
ec = INDEX_SIZE_ERR;
}
void AnalyserNode::setMinDecibels(float k, ExceptionCode& ec)
void AnalyserNode::setMinDecibels(double k, ExceptionCode& ec)
{
if (k > maxDecibels()) {
ec = INDEX_SIZE_ERR;
......@@ -88,7 +88,7 @@ void AnalyserNode::setMinDecibels(float k, ExceptionCode& ec)
m_analyser.setMinDecibels(k);
}
void AnalyserNode::setMaxDecibels(float k, ExceptionCode& ec)
void AnalyserNode::setMaxDecibels(double k, ExceptionCode& ec)
{
if (k < minDecibels()) {
ec = INDEX_SIZE_ERR;
......@@ -98,7 +98,7 @@ void AnalyserNode::setMaxDecibels(float k, ExceptionCode& ec)
m_analyser.setMaxDecibels(k);
}
void AnalyserNode::setSmoothingTimeConstant(float k, ExceptionCode& ec)
void AnalyserNode::setSmoothingTimeConstant(double k, ExceptionCode& ec)
{
if (k < 0 || k > 1) {
ec = INDEX_SIZE_ERR;
......
......@@ -50,14 +50,14 @@ public:
unsigned frequencyBinCount() const { return m_analyser.frequencyBinCount(); }
void setMinDecibels(float k, ExceptionCode&);
float minDecibels() const { return m_analyser.minDecibels(); }
void setMinDecibels(double k, ExceptionCode&);
double minDecibels() const { return m_analyser.minDecibels(); }
void setMaxDecibels(float k, ExceptionCode&);
float maxDecibels() const { return m_analyser.maxDecibels(); }
void setMaxDecibels(double k, ExceptionCode&);
double maxDecibels() const { return m_analyser.maxDecibels(); }
void setSmoothingTimeConstant(float k, ExceptionCode&);
float smoothingTimeConstant() const { return m_analyser.smoothingTimeConstant(); }
void setSmoothingTimeConstant(double k, ExceptionCode&);
double smoothingTimeConstant() const { return m_analyser.smoothingTimeConstant(); }
void getFloatFrequencyData(JSC::Float32Array* array) { m_analyser.getFloatFrequencyData(array); }
void getByteFrequencyData(JSC::Uint8Array* array) { m_analyser.getByteFrequencyData(array); }
......
......@@ -30,11 +30,11 @@
readonly attribute unsigned long frequencyBinCount;
// minDecibels / maxDecibels represent the range to scale the FFT analysis data for conversion to unsigned byte values.
[SetterRaisesException] attribute float minDecibels;
[SetterRaisesException] attribute float maxDecibels;
[SetterRaisesException] attribute double minDecibels;
[SetterRaisesException] attribute double maxDecibels;
// A value from 0.0 -> 1.0 where 0.0 represents no time averaging with the last analysis frame.
[SetterRaisesException] attribute float smoothingTimeConstant;
[SetterRaisesException] attribute double smoothingTimeConstant;
// Copies the current frequency data into the passed array.
// If the array has fewer elements than the frequencyBinCount, the excess elements will be dropped.
......
......@@ -35,7 +35,7 @@
readonly attribute AudioDestinationNode destination;
// All scheduled times are relative to this time in seconds.
readonly attribute float currentTime;
readonly attribute double currentTime;
// All AudioNodes in the context run at this sample-rate (sample-frames per second).
readonly attribute float sampleRate;
......
......@@ -50,14 +50,14 @@ public:
unsigned frequencyBinCount() const { return m_fftSize / 2; }
void setMinDecibels(float k) { m_minDecibels = k; }
float minDecibels() const { return static_cast<float>(m_minDecibels); }
void setMinDecibels(double k) { m_minDecibels = k; }
double minDecibels() const { return m_minDecibels; }
void setMaxDecibels(float k) { m_maxDecibels = k; }
float maxDecibels() const { return static_cast<float>(m_maxDecibels); }
void setMaxDecibels(double k) { m_maxDecibels = k; }
double maxDecibels() const { return m_maxDecibels; }
void setSmoothingTimeConstant(float k) { m_smoothingTimeConstant = k; }
float smoothingTimeConstant() const { return static_cast<float>(m_smoothingTimeConstant); }
void setSmoothingTimeConstant(double k) { m_smoothingTimeConstant = k; }
double smoothingTimeConstant() const { return m_smoothingTimeConstant; }
void getFloatFrequencyData(JSC::Float32Array*);
void getByteFrequencyData(JSC::Uint8Array*);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment