[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 15:36:47 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit dc6ac6fefc7964ba592ba2b1b967b083786f6059
Author: crogers at google.com <crogers at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 9 08:40:47 2010 +0000

    2010-11-09  Chris Rogers  <crogers at google.com>
    
            Reviewed by Kenneth Russell.
    
            audio engine: add audio resources abstraction
            https://bugs.webkit.org/show_bug.cgi?id=34660
    
            No new tests since audio API is not yet implemented.
    
            * platform/audio/AudioBus.h:
            * platform/audio/HRTFElevation.cpp:
            (WebCore::HRTFElevation::calculateKernelsForAzimuthElevation):
            (WebCore::HRTFElevation::createByInterpolatingSlices):
            * platform/audio/mac/AudioBusMac.mm: Added.
            (WebCore::AudioBus::loadPlatformResource):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71613 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 5fe6a73..8b549a5 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2010-11-09  Chris Rogers  <crogers at google.com>
+
+        Reviewed by Kenneth Russell.
+
+        audio engine: add audio resources abstraction
+        https://bugs.webkit.org/show_bug.cgi?id=34660
+
+        No new tests since audio API is not yet implemented.
+
+        * platform/audio/AudioBus.h:
+        * platform/audio/HRTFElevation.cpp:
+        (WebCore::HRTFElevation::calculateKernelsForAzimuthElevation):
+        (WebCore::HRTFElevation::createByInterpolatingSlices):
+        * platform/audio/mac/AudioBusMac.mm: Added.
+        (WebCore::AudioBus::loadPlatformResource):
+
 2010-11-09  James Simonsen  <simonjam at chromium.org>
 
         Reviewed by Dimitri Glazkov.
diff --git a/WebCore/platform/audio/AudioBus.h b/WebCore/platform/audio/AudioBus.h
index 72357e8..4318b81 100644
--- a/WebCore/platform/audio/AudioBus.h
+++ b/WebCore/platform/audio/AudioBus.h
@@ -117,6 +117,8 @@ public:
     // Makes maximum absolute value == 1.0 (if possible).
     void normalize();
 
+    static PassOwnPtr<AudioBus> loadPlatformResource(const char* name, double sampleRate);
+
 protected:
     AudioBus() { };
 
diff --git a/WebCore/platform/audio/HRTFElevation.cpp b/WebCore/platform/audio/HRTFElevation.cpp
index ac1eb4d..ab722cd 100644
--- a/WebCore/platform/audio/HRTFElevation.cpp
+++ b/WebCore/platform/audio/HRTFElevation.cpp
@@ -101,7 +101,7 @@ bool HRTFElevation::calculateKernelsForAzimuthElevation(int azimuth, int elevati
     int positiveElevation = elevation < 0 ? elevation + 360 : elevation;
     String resourceName = String::format("IRC_%s_C_R0195_T%03d_P%03d", subjectName.utf8().data(), azimuth, positiveElevation);
 
-    OwnPtr<AudioBus> impulseResponse(createBusFromAudioFileResource(resourceName, sampleRate));
+    OwnPtr<AudioBus> impulseResponse(AudioBus::loadPlatformResource(resourceName.utf8().data(), sampleRate));
 
     ASSERT(impulseResponse.get());
     if (!impulseResponse.get())
@@ -224,7 +224,7 @@ PassOwnPtr<HRTFElevation> HRTFElevation::createByInterpolatingSlices(HRTFElevati
     // Interpolate elevation angle.
     double angle = (1.0 - x) * hrtfElevation1->elevationAngle() + x * hrtfElevation2->elevationAngle();
     
-    OwnPtr<HRTFElevation> hrtfElevation = adoptPtr(new HRTFElevation(kernelListL.release(), kernelListR.release(), angle, sampleRate));
+    OwnPtr<HRTFElevation> hrtfElevation = adoptPtr(new HRTFElevation(kernelListL.release(), kernelListR.release(), static_cast<int>(angle), sampleRate));
     return hrtfElevation.release();  
 }
 
diff --git a/WebCore/platform/audio/mac/AudioBusMac.mm b/WebCore/platform/audio/mac/AudioBusMac.mm
new file mode 100644
index 0000000..3f3185a
--- /dev/null
+++ b/WebCore/platform/audio/mac/AudioBusMac.mm
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+#import "config.h"
+
+#if ENABLE(WEB_AUDIO)
+
+#import "AudioBus.h"
+
+#import "AudioFileReader.h"
+#import <wtf/OwnPtr.h>
+#import <wtf/PassOwnPtr.h>
+#import <Foundation/Foundation.h>
+
+ at interface WebCoreAudioBundleClass : NSObject
+ at end
+
+ at implementation WebCoreAudioBundleClass
+ at end
+
+namespace WebCore {
+
+PassOwnPtr<AudioBus> AudioBus::loadPlatformResource(const char* name, double sampleRate)
+{
+    // This method can be called from other than the main thread, so we need an auto-release pool.
+    NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
+    
+    NSBundle *bundle = [NSBundle bundleForClass:[WebCoreAudioBundleClass class]];
+    NSString *audioFilePath = [bundle pathForResource:[NSString stringWithUTF8String:name] ofType:@"aif" inDirectory:@"audio"];
+    NSData *audioData = [NSData dataWithContentsOfFile:audioFilePath];
+
+    if (audioData) {
+        OwnPtr<AudioBus> bus(createBusFromInMemoryAudioFile([audioData bytes], [audioData length], false, sampleRate));
+        [pool release];
+        return bus.release();
+    }
+
+    ASSERT_NOT_REACHED();
+    [pool release];
+    return 0;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_AUDIO)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list