[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

crogers at google.com crogers at google.com
Wed Dec 22 14:10:31 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit ee7b0524c0bc96522ab65384c28acde20bd92f98
Author: crogers at google.com <crogers at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Oct 5 06:22:06 2010 +0000

    2010-10-04  Chris Rogers  <crogers at google.com>
    
            Reviewed by Kenneth Russell.
    
            Add AudioUtilities files
            https://bugs.webkit.org/show_bug.cgi?id=47011
    
            No new tests since audio API is not yet implemented.
    
            * platform/audio/AudioUtilities.cpp: Added.
            (WebCore::AudioUtilities::decibelsToLinear):
            (WebCore::AudioUtilities::linearToDecibels):
            (WebCore::AudioUtilities::discreteTimeConstantForSampleRate):
            * platform/audio/AudioUtilities.h: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69083 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 3bec9bb..8805555 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2010-10-04  Chris Rogers  <crogers at google.com>
+
+        Reviewed by Kenneth Russell.
+
+        Add AudioUtilities files
+        https://bugs.webkit.org/show_bug.cgi?id=47011
+
+        No new tests since audio API is not yet implemented.
+
+        * platform/audio/AudioUtilities.cpp: Added.
+        (WebCore::AudioUtilities::decibelsToLinear):
+        (WebCore::AudioUtilities::linearToDecibels):
+        (WebCore::AudioUtilities::discreteTimeConstantForSampleRate):
+        * platform/audio/AudioUtilities.h: Added.
+
 2010-10-04  David Hyatt  <hyatt at apple.com>
 
         Reviewed by Dan Bernstein.
diff --git a/WebCore/platform/audio/AudioUtilities.cpp b/WebCore/platform/audio/AudioUtilities.cpp
new file mode 100644
index 0000000..32f4335
--- /dev/null
+++ b/WebCore/platform/audio/AudioUtilities.cpp
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2010, Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "AudioUtilities.h"
+
+#include <math.h>
+
+namespace WebCore {
+
+namespace AudioUtilities {
+
+double decibelsToLinear(double decibels)
+{
+    return pow(10.0, 0.05 * decibels);
+}
+
+double linearToDecibels(double linear)
+{
+    // It's not possible to calculate decibels for a zero linear value since it would be -Inf.
+    // -1000.0 dB represents a very tiny linear value in case we ever reach this case.
+    ASSERT(linear);
+    if (!linear)
+        return -1000.0;
+        
+    return 20.0 * log10(linear);
+}
+
+double discreteTimeConstantForSampleRate(double timeConstant, double sampleRate)
+{
+    return 1.0 - pow(1.0 / M_E, 1.0 / (sampleRate * timeConstant));
+}
+    
+} // AudioUtilites
+
+} // WebCore
diff --git a/WebCore/platform/audio/AudioUtilities.h b/WebCore/platform/audio/AudioUtilities.h
new file mode 100644
index 0000000..7cf44ce
--- /dev/null
+++ b/WebCore/platform/audio/AudioUtilities.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2010, Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AudioUtilities_h
+#define AudioUtilities_h
+
+namespace WebCore {
+
+namespace AudioUtilities {
+
+// Standard functions for converting to and from decibel values from linear.
+double linearToDecibels(double);
+double decibelsToLinear(double);
+
+// timeConstant is the time it takes a first-order linear time-invariant system
+// to reach the value 1 - 1/e (around 63.2%) given a step input response.
+// discreteTimeConstantForSampleRate() will return the discrete time-constant for the specific sampleRate.
+double discreteTimeConstantForSampleRate(double timeConstant, double sampleRate);
+    
+} // AudioUtilites
+
+} // WebCore
+
+#endif // AudioUtilities_h

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list