From c0043d57681f31d7c3629252fe7de2956c8cf054 Mon Sep 17 00:00:00 2001 From: "commit-queue@webkit.org" Date: Thu, 5 Sep 2013 13:25:50 +0000 Subject: [PATCH] Precision updates in WebAudio. https://bugs.webkit.org/show_bug.cgi?id=119739 Patch by Praveen R Jadhav 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: https://svn.webkit.org/repository/webkit/trunk@155112 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebCore/ChangeLog | 36 +++++++++++++++++++ .../WebCore/Modules/webaudio/AnalyserNode.cpp | 6 ++-- .../WebCore/Modules/webaudio/AnalyserNode.h | 12 +++---- .../WebCore/Modules/webaudio/AnalyserNode.idl | 6 ++-- .../WebCore/Modules/webaudio/AudioContext.idl | 2 +- .../Modules/webaudio/RealtimeAnalyser.h | 12 +++---- 6 files changed, 55 insertions(+), 19 deletions(-) diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index c8834097f7ed..e9859035491c 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,39 @@ +2013-09-05 Praveen R Jadhav + + 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 Replace node() calls with generatingNode() for RenderRegion code diff --git a/Source/WebCore/Modules/webaudio/AnalyserNode.cpp b/Source/WebCore/Modules/webaudio/AnalyserNode.cpp index 681f7aef8174..b54d3ae28484 100644 --- a/Source/WebCore/Modules/webaudio/AnalyserNode.cpp +++ b/Source/WebCore/Modules/webaudio/AnalyserNode.cpp @@ -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; diff --git a/Source/WebCore/Modules/webaudio/AnalyserNode.h b/Source/WebCore/Modules/webaudio/AnalyserNode.h index c3aa5c7782c0..406be8616e5b 100644 --- a/Source/WebCore/Modules/webaudio/AnalyserNode.h +++ b/Source/WebCore/Modules/webaudio/AnalyserNode.h @@ -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); } diff --git a/Source/WebCore/Modules/webaudio/AnalyserNode.idl b/Source/WebCore/Modules/webaudio/AnalyserNode.idl index eb4da41498fa..ddc33a83ee9d 100644 --- a/Source/WebCore/Modules/webaudio/AnalyserNode.idl +++ b/Source/WebCore/Modules/webaudio/AnalyserNode.idl @@ -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. diff --git a/Source/WebCore/Modules/webaudio/AudioContext.idl b/Source/WebCore/Modules/webaudio/AudioContext.idl index 4d49605ed1d3..ef3190656db2 100644 --- a/Source/WebCore/Modules/webaudio/AudioContext.idl +++ b/Source/WebCore/Modules/webaudio/AudioContext.idl @@ -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; diff --git a/Source/WebCore/Modules/webaudio/RealtimeAnalyser.h b/Source/WebCore/Modules/webaudio/RealtimeAnalyser.h index a64b8be789e4..80c6868b7d23 100644 --- a/Source/WebCore/Modules/webaudio/RealtimeAnalyser.h +++ b/Source/WebCore/Modules/webaudio/RealtimeAnalyser.h @@ -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(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(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(m_smoothingTimeConstant); } + void setSmoothingTimeConstant(double k) { m_smoothingTimeConstant = k; } + double smoothingTimeConstant() const { return m_smoothingTimeConstant; } void getFloatFrequencyData(JSC::Float32Array*); void getByteFrequencyData(JSC::Uint8Array*); -- 2.36.0