Title: [265062] trunk
Revision
265062
Author
[email protected]
Date
2020-07-29 15:07:03 -0700 (Wed, 29 Jul 2020)

Log Message

Added copyFromChannel, copyToChannel to AudioBuffer
https://bugs.webkit.org/show_bug.cgi?id=214926

Patch by Clark Wang <[email protected]> on 2020-07-29
Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

       Re-baselined existing tests. Fails on catching sharedBuffer being passed in, but currently
WebKit does not support sharedBuffer implementation.

* web-platform-tests/webaudio/idlharness.https.window-expected.txt:
* web-platform-tests/webaudio/the-audio-api/the-audiobuffer-interface/audiobuffer-copy-channel-expected.txt:
* web-platform-tests/webaudio/the-audio-api/the-audiobuffer-interface/audiobuffer-expected.txt:
* web-platform-tests/webaudio/the-audio-api/the-waveshapernode-interface/waveshaper-limits-expected.txt:

Source/WebCore:

Added copyFromChannel, copyToChannel methods according to spec:
https://www.w3.org/TR/webaudio/#dom-audiobuffer-copyfromchannel-destination.
Used Chromium implementation for reference:
https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/modules/webaudio/audio_buffer.cc.

Re-baselined existing tests. Fails on catching sharedBuffer being passed in, but currently
WebKit does not support sharedBuffer implementation.

* Modules/webaudio/AudioBuffer.cpp:
(WebCore::AudioBuffer::getChannelData):
(WebCore::AudioBuffer::copyFromChannel):
(WebCore::AudioBuffer::copyToChannel):
* Modules/webaudio/AudioBuffer.h:
* Modules/webaudio/AudioBuffer.idl:

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (265061 => 265062)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2020-07-29 22:00:20 UTC (rev 265061)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2020-07-29 22:07:03 UTC (rev 265062)
@@ -1,3 +1,18 @@
+2020-07-29  Clark Wang  <[email protected]>
+
+        Added copyFromChannel, copyToChannel to AudioBuffer
+        https://bugs.webkit.org/show_bug.cgi?id=214926
+
+        Reviewed by Chris Dumez.
+
+       Re-baselined existing tests. Fails on catching sharedBuffer being passed in, but currently
+        WebKit does not support sharedBuffer implementation.
+
+        * web-platform-tests/webaudio/idlharness.https.window-expected.txt:
+        * web-platform-tests/webaudio/the-audio-api/the-audiobuffer-interface/audiobuffer-copy-channel-expected.txt:
+        * web-platform-tests/webaudio/the-audio-api/the-audiobuffer-interface/audiobuffer-expected.txt:
+        * web-platform-tests/webaudio/the-audio-api/the-waveshapernode-interface/waveshaper-limits-expected.txt:
+
 2020-07-29  Commit Queue  <[email protected]>
 
         Unreviewed, reverting r265002.

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/idlharness.https.window-expected.txt (265061 => 265062)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/idlharness.https.window-expected.txt	2020-07-29 22:00:20 UTC (rev 265061)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/idlharness.https.window-expected.txt	2020-07-29 22:07:03 UTC (rev 265062)
@@ -180,8 +180,8 @@
 PASS AudioBuffer interface: attribute duration 
 PASS AudioBuffer interface: attribute numberOfChannels 
 PASS AudioBuffer interface: operation getChannelData(unsigned long) 
-FAIL AudioBuffer interface: operation copyFromChannel(Float32Array, unsigned long, optional unsigned long) assert_own_property: interface prototype object missing non-static operation expected property "copyFromChannel" missing
-FAIL AudioBuffer interface: operation copyToChannel(Float32Array, unsigned long, optional unsigned long) assert_own_property: interface prototype object missing non-static operation expected property "copyToChannel" missing
+PASS AudioBuffer interface: operation copyFromChannel(Float32Array, unsigned long, optional unsigned long) 
+PASS AudioBuffer interface: operation copyToChannel(Float32Array, unsigned long, optional unsigned long) 
 FAIL AudioBuffer must be primary interface of buffer assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: buffer"
 FAIL Stringification of buffer assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: buffer"
 FAIL AudioBuffer interface: buffer must inherit property "sampleRate" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: buffer"

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiobuffer-interface/audiobuffer-copy-channel-expected.txt (265061 => 265062)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiobuffer-interface/audiobuffer-copy-channel-expected.txt	2020-07-29 22:00:20 UTC (rev 265061)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiobuffer-interface/audiobuffer-copy-channel-expected.txt	2020-07-29 22:07:03 UTC (rev 265062)
@@ -3,39 +3,62 @@
 PASS Executing "initialize" 
 PASS Executing "copyFrom-exceptions" 
 PASS Executing "copyTo-exceptions" 
-FAIL Executing "copyFrom-validate" promise_test: Unhandled rejection with value: object "TypeError: buffer.copyFromChannel is not a function. (In 'buffer.copyFromChannel(dst8, c)', 'buffer.copyFromChannel' is undefined)"
-FAIL Executing "copyTo-validate" promise_test: Unhandled rejection with value: object "TypeError: buffer.copyToChannel is not a function. (In 'buffer.copyToChannel(src, c)', 'buffer.copyToChannel' is undefined)"
+PASS Executing "copyFrom-validate" 
+PASS Executing "copyTo-validate" 
 PASS Audit report 
 PASS > [initialize]  
 PASS   Initialized values contains only the constant -1. 
 PASS < [initialize] All assertions passed. (total 1 assertions) 
 PASS > [copyFrom-exceptions]  
-FAIL X AudioBuffer.prototype.copyFromChannel does not exist. Got undefined. assert_true: expected true got false
+PASS   AudioBuffer.prototype.copyFromChannel does exist. 
 PASS   0: buffer = context.createBuffer(3, 16, context.sampleRate) did not throw an exception. 
-PASS   1: buffer.copyFromChannel(null, 0) threw TypeError: "buffer.copyFromChannel is not a function. (In 'buffer.copyFromChannel(null, 0)', 'buffer.copyFromChannel' is undefined)". 
-PASS   2: buffer.copyFromChannel(context, 0) threw TypeError: "buffer.copyFromChannel is not a function. (In 'buffer.copyFromChannel(context, 0)', 'buffer.copyFromChannel' is undefined)". 
-FAIL X 3: buffer.copyFromChannel(x, -1) threw "TypeError" instead of IndexSizeError. assert_true: expected true got false
-FAIL X 4: buffer.copyFromChannel(x, 3) threw "TypeError" instead of IndexSizeError. assert_true: expected true got false
-FAIL X 5: buffer.copyFromChannel(x, 0, -1) incorrectly threw TypeError: "buffer.copyFromChannel is not a function. (In 'buffer.copyFromChannel(x, 0, -1)', 'buffer.copyFromChannel' is undefined)". assert_true: expected true got false
-FAIL X 6: buffer.copyFromChannel(x, 0, 16) incorrectly threw TypeError: "buffer.copyFromChannel is not a function. (In 'buffer.copyFromChannel(x, 0, bufferLength)', 'buffer.copyFromChannel' is undefined)". assert_true: expected true got false
-FAIL X 7: buffer.copyFromChannel(x, 3) threw "TypeError" instead of IndexSizeError. assert_true: expected true got false
-PASS   8: buffer.copyFromChannel(SharedArrayBuffer view, 0) threw TypeError: "buffer.copyFromChannel is not a function. (In 'buffer.copyFromChannel(shared_buffer, 0)', 'buffer.copyFromChannel' is undefined)". 
-PASS   9: buffer.copyFromChannel(SharedArrayBuffer view, 0, 0) threw TypeError: "buffer.copyFromChannel is not a function. (In 'buffer.copyFromChannel(shared_buffer, 0, 0)', 'buffer.copyFromChannel' is undefined)". 
-FAIL < [copyFrom-exceptions] 6 out of 11 assertions were failed. assert_true: expected true got false
+PASS   1: buffer.copyFromChannel(null, 0) threw TypeError: "Argument 1 ('destination') to AudioBuffer.copyFromChannel must be an instance of Float32Array". 
+PASS   2: buffer.copyFromChannel(context, 0) threw TypeError: "Argument 1 ('destination') to AudioBuffer.copyFromChannel must be an instance of Float32Array". 
+PASS   3: buffer.copyFromChannel(x, -1) threw IndexSizeError: "Not a valid channelNumber.". 
+PASS   4: buffer.copyFromChannel(x, 3) threw IndexSizeError: "Not a valid channelNumber.". 
+PASS   5: buffer.copyFromChannel(x, 0, -1) did not throw an exception. 
+PASS   6: buffer.copyFromChannel(x, 0, 16) did not throw an exception. 
+PASS   7: buffer.copyFromChannel(x, 3) threw IndexSizeError: "Not a valid channelNumber.". 
+FAIL X 8: buffer.copyFromChannel(SharedArrayBuffer view, 0) did not throw an exception. assert_true: expected true got false
+FAIL X 9: buffer.copyFromChannel(SharedArrayBuffer view, 0, 0) did not throw an exception. assert_true: expected true got false
+FAIL < [copyFrom-exceptions] 2 out of 11 assertions were failed. assert_true: expected true got false
 PASS > [copyTo-exceptions]  
-FAIL X AudioBuffer.prototype.copyToChannel does not exist. Got undefined. assert_true: expected true got false
-PASS   0: buffer.copyToChannel(null, 0) threw TypeError: "buffer.copyToChannel is not a function. (In 'buffer.copyToChannel(null, 0)', 'buffer.copyToChannel' is undefined)". 
-PASS   1: buffer.copyToChannel(context, 0) threw TypeError: "buffer.copyToChannel is not a function. (In 'buffer.copyToChannel(context, 0)', 'buffer.copyToChannel' is undefined)". 
-FAIL X 2: buffer.copyToChannel(x, -1) threw "TypeError" instead of IndexSizeError. assert_true: expected true got false
-FAIL X 3: buffer.copyToChannel(x, 3) threw "TypeError" instead of IndexSizeError. assert_true: expected true got false
-FAIL X 4: buffer.copyToChannel(x, 0, -1) incorrectly threw TypeError: "buffer.copyToChannel is not a function. (In 'buffer.copyToChannel(x, 0, -1)', 'buffer.copyToChannel' is undefined)". assert_true: expected true got false
-FAIL X 5: buffer.copyToChannel(x, 0, 16) incorrectly threw TypeError: "buffer.copyToChannel is not a function. (In 'buffer.copyToChannel(x, 0, bufferLength)', 'buffer.copyToChannel' is undefined)". assert_true: expected true got false
-FAIL X 6: buffer.copyToChannel(x, 3) threw "TypeError" instead of IndexSizeError. assert_true: expected true got false
-PASS   7: buffer.copyToChannel(SharedArrayBuffer view, 0) threw TypeError: "buffer.copyToChannel is not a function. (In 'buffer.copyToChannel(shared_buffer, 0)', 'buffer.copyToChannel' is undefined)". 
-PASS   8: buffer.copyToChannel(SharedArrayBuffer view, 0, 0) threw TypeError: "buffer.copyToChannel is not a function. (In 'buffer.copyToChannel(shared_buffer, 0, 0)', 'buffer.copyToChannel' is undefined)". 
-FAIL < [copyTo-exceptions] 6 out of 10 assertions were failed. assert_true: expected true got false
+PASS   AudioBuffer.prototype.copyToChannel does exist. 
+PASS   0: buffer.copyToChannel(null, 0) threw TypeError: "Argument 1 ('source') to AudioBuffer.copyToChannel must be an instance of Float32Array". 
+PASS   1: buffer.copyToChannel(context, 0) threw TypeError: "Argument 1 ('source') to AudioBuffer.copyToChannel must be an instance of Float32Array". 
+PASS   2: buffer.copyToChannel(x, -1) threw IndexSizeError: "Not a valid channelNumber.". 
+PASS   3: buffer.copyToChannel(x, 3) threw IndexSizeError: "Not a valid channelNumber.". 
+PASS   4: buffer.copyToChannel(x, 0, -1) did not throw an exception. 
+PASS   5: buffer.copyToChannel(x, 0, 16) did not throw an exception. 
+PASS   6: buffer.copyToChannel(x, 3) threw IndexSizeError: "Not a valid channelNumber.". 
+FAIL X 7: buffer.copyToChannel(SharedArrayBuffer view, 0) did not throw an exception. assert_true: expected true got false
+FAIL X 8: buffer.copyToChannel(SharedArrayBuffer view, 0, 0) did not throw an exception. assert_true: expected true got false
+FAIL < [copyTo-exceptions] 2 out of 10 assertions were failed. assert_true: expected true got false
 PASS > [copyFrom-validate]  
+PASS   buffer.copyFromChannel(dst8, 0) is identical to the array [1,2,3,4,5,6,7,8]. 
+PASS   buffer.copyFromChannel(dst8, 1) is identical to the array [2,3,4,5,6,7,8,9]. 
+PASS   buffer.copyFromChannel(dst8, 2) is identical to the array [3,4,5,6,7,8,9,10]. 
+PASS   buffer.copyFromChannel(dst8, 0, 1) is identical to the array [2,3,4,5,6,7,8,9]. 
+PASS   buffer.copyFromChannel(dst8, 1, 1) is identical to the array [3,4,5,6,7,8,9,10]. 
+PASS   buffer.copyFromChannel(dst8, 2, 1) is identical to the array [4,5,6,7,8,9,10,11]. 
+PASS   buffer.copyFromChannel(dst8, 0, 11) is identical to the array [12,13,14,15,16,-1,-1,-1]. 
+PASS   buffer.copyFromChannel(dst8, 1, 11) is identical to the array [13,14,15,16,17,-1,-1,-1]. 
+PASS   buffer.copyFromChannel(dst8, 2, 11) is identical to the array [14,15,16,17,18,-1,-1,-1]. 
+PASS   buffer.copyFromChannel(dst26, 0) is identical to the array [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16...]. 
+PASS   buffer.copyFromChannel(dst26, 1) is identical to the array [2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17...]. 
+PASS   buffer.copyFromChannel(dst26, 2) is identical to the array [3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18...]. 
+PASS < [copyFrom-validate] All assertions passed. (total 12 assertions) 
 PASS > [copyTo-validate]  
 PASS   buffer = createConstantBuffer(context, 16, [-1,-1,-1]) did not throw an exception. 
+PASS   buffer.copyToChannel(src, 0) is identical to the array [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16...]. 
+PASS   buffer.copyToChannel(src, 1) is identical to the array [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16...]. 
+PASS   buffer.copyToChannel(src, 2) is identical to the array [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16...]. 
+PASS   buffer.copyToChannel(src10, 0) is identical to the array [1,2,3,4,5,6,7,8,9,10,-1,-1,-1,-1,-1,-1...]. 
+PASS   buffer.copyToChannel(src10, 1) is identical to the array [1,2,3,4,5,6,7,8,9,10,-1,-1,-1,-1,-1,-1...]. 
+PASS   buffer.copyToChannel(src10, 2) is identical to the array [1,2,3,4,5,6,7,8,9,10,-1,-1,-1,-1,-1,-1...]. 
+PASS   buffer.copyToChannel(src10, 0, 5) is identical to the array [-1,-1,-1,-1,-1,1,2,3,4,5,6,7,8,9,10,-1...]. 
+PASS   buffer.copyToChannel(src10, 1, 5) is identical to the array [-1,-1,-1,-1,-1,1,2,3,4,5,6,7,8,9,10,-1...]. 
+PASS   buffer.copyToChannel(src10, 2, 5) is identical to the array [-1,-1,-1,-1,-1,1,2,3,4,5,6,7,8,9,10,-1...]. 
+PASS < [copyTo-validate] All assertions passed. (total 10 assertions) 
 FAIL # AUDIT TASK RUNNER FINISHED: 2 out of 5 tasks were failed. assert_true: expected true got false
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiobuffer-interface/audiobuffer-expected.txt (265061 => 265062)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiobuffer-interface/audiobuffer-expected.txt	2020-07-29 22:00:20 UTC (rev 265061)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiobuffer-interface/audiobuffer-expected.txt	2020-07-29 22:07:03 UTC (rev 265062)
@@ -12,7 +12,7 @@
 PASS   buffer.getChannelData(1) instanceof window.Float32Array is true. 
 PASS   buffer.getChannelData(2) instanceof window.Float32Array is true. 
 PASS   buffer.getChannelData(3) instanceof window.Float32Array is true. 
-PASS   buffer.getChannelData(4) threw SyntaxError: "The string did not match the expected pattern.". 
+PASS   buffer.getChannelData(4) threw IndexSizeError: "Index must be less than number of channels.". 
 FAIL X context.createBuffer(1, 1000, 24576).duration is not equal to 0.040690104166666664. Got 0.0406901054084301. assert_true: expected true got false
 FAIL < [Basic tests for AudioBuffer] 1 out of 11 assertions were failed. assert_true: expected true got false
 FAIL # AUDIT TASK RUNNER FINISHED: 1 out of 1 tasks were failed. assert_true: expected true got false

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-waveshapernode-interface/waveshaper-limits-expected.txt (265061 => 265062)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-waveshapernode-interface/waveshaper-limits-expected.txt	2020-07-29 22:00:20 UTC (rev 265061)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-waveshapernode-interface/waveshaper-limits-expected.txt	2020-07-29 22:07:03 UTC (rev 265062)
@@ -1,6 +1,7 @@
 
 PASS # AUDIT TASK RUNNER STARTED. 
-FAIL Executing "test" promise_test: Unhandled rejection with value: object "TypeError: buffer.copyToChannel is not a function. (In 'buffer.copyToChannel(bufferData, 0)', 'buffer.copyToChannel' is undefined)"
+FAIL Executing "test" promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'context.startRendering()
+                .then')"
 PASS Audit report 
 PASS > [test] WaveShaperNode including values outside the range of [-1,1] 
 PASS # AUDIT TASK RUNNER FINISHED: 1 tasks ran successfully. 

Modified: trunk/Source/WebCore/ChangeLog (265061 => 265062)


--- trunk/Source/WebCore/ChangeLog	2020-07-29 22:00:20 UTC (rev 265061)
+++ trunk/Source/WebCore/ChangeLog	2020-07-29 22:07:03 UTC (rev 265062)
@@ -1,3 +1,25 @@
+2020-07-29  Clark Wang  <[email protected]>
+
+        Added copyFromChannel, copyToChannel to AudioBuffer
+        https://bugs.webkit.org/show_bug.cgi?id=214926
+
+        Reviewed by Chris Dumez.
+
+        Added copyFromChannel, copyToChannel methods according to spec: 
+        https://www.w3.org/TR/webaudio/#dom-audiobuffer-copyfromchannel-destination.
+        Used Chromium implementation for reference:
+        https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/modules/webaudio/audio_buffer.cc.
+
+        Re-baselined existing tests. Fails on catching sharedBuffer being passed in, but currently
+        WebKit does not support sharedBuffer implementation.
+
+        * Modules/webaudio/AudioBuffer.cpp:
+        (WebCore::AudioBuffer::getChannelData):
+        (WebCore::AudioBuffer::copyFromChannel):
+        (WebCore::AudioBuffer::copyToChannel):
+        * Modules/webaudio/AudioBuffer.h:
+        * Modules/webaudio/AudioBuffer.idl:
+
 2020-07-29  Wenson Hsieh  <[email protected]>
 
         [macOS] Inspector bar in Mail compose shows incorrect text alignment style for ranged selections

Modified: trunk/Source/WebCore/Modules/webaudio/AudioBuffer.cpp (265061 => 265062)


--- trunk/Source/WebCore/Modules/webaudio/AudioBuffer.cpp	2020-07-29 22:00:20 UTC (rev 265061)
+++ trunk/Source/WebCore/Modules/webaudio/AudioBuffer.cpp	2020-07-29 22:07:03 UTC (rev 265062)
@@ -113,7 +113,7 @@
 ExceptionOr<Ref<Float32Array>> AudioBuffer::getChannelData(unsigned channelIndex)
 {
     if (channelIndex >= m_channels.size())
-        return Exception { SyntaxError };
+        return Exception { IndexSizeError, "Index must be less than number of channels."_s };
     auto& channelData = *m_channels[channelIndex];
     return Float32Array::create(channelData.unsharedBuffer(), channelData.byteOffset(), channelData.length());
 }
@@ -125,6 +125,62 @@
     return m_channels[channelIndex].get();
 }
 
+ExceptionOr<void> AudioBuffer::copyFromChannel(Ref<Float32Array>&& destination, unsigned channelNumber, unsigned bufferOffset)
+{
+    if (destination->isShared())
+        return Exception { TypeError, "Destination may not be a shared buffer."_s };
+    
+    if (channelNumber < 0 || channelNumber >= m_channels.size())
+        return Exception { IndexSizeError, "Not a valid channelNumber."_s };
+    
+    Float32Array* channelData = m_channels[channelNumber].get();
+    
+    size_t dataLength = channelData->length();
+    
+    if (bufferOffset >= dataLength)
+        return { };
+    
+    unsigned count = dataLength - bufferOffset;
+    count = std::min(destination.get().length(), count);
+    
+    const float* src = ""
+    float* dst = destination->data();
+    
+    ASSERT(src);
+    ASSERT(dst);
+    
+    memmove(dst, src + bufferOffset, count * sizeof(*src));
+    return { };
+}
+
+ExceptionOr<void> AudioBuffer::copyToChannel(Ref<Float32Array>&& source, unsigned channelNumber, unsigned bufferOffset)
+{
+    if (source->isShared())
+        return Exception { TypeError, "Source may not be a shared buffer."_s };
+    
+    if (channelNumber < 0 || channelNumber >= m_channels.size())
+        return Exception { IndexSizeError, "Not a valid channelNumber."_s };
+    
+    Float32Array* channelData = m_channels[channelNumber].get();
+    
+    size_t dataLength = channelData->length();
+    
+    if (bufferOffset >= dataLength)
+        return { };
+    
+    unsigned count = dataLength - bufferOffset;
+    count = std::min(source.get().length(), count);
+    
+    const float* src = ""
+    float* dst = channelData->data();
+    
+    ASSERT(src);
+    ASSERT(dst);
+    
+    memmove(dst + bufferOffset, src, count * sizeof(*dst));
+    return { };
+}
+
 void AudioBuffer::zero()
 {
     for (auto& channel : m_channels)

Modified: trunk/Source/WebCore/Modules/webaudio/AudioBuffer.h (265061 => 265062)


--- trunk/Source/WebCore/Modules/webaudio/AudioBuffer.h	2020-07-29 22:00:20 UTC (rev 265061)
+++ trunk/Source/WebCore/Modules/webaudio/AudioBuffer.h	2020-07-29 22:07:03 UTC (rev 265062)
@@ -53,6 +53,8 @@
     // Channel data access
     unsigned numberOfChannels() const { return m_channels.size(); }
     ExceptionOr<Ref<Float32Array>> getChannelData(unsigned channelIndex);
+    ExceptionOr<void> copyFromChannel(Ref<Float32Array>&&, unsigned channelNumber, unsigned bufferOffset);
+    ExceptionOr<void> copyToChannel(Ref<Float32Array>&&, unsigned channelNumber, unsigned startInChannel);
     Float32Array* channelData(unsigned channelIndex);
     void zero();
 

Modified: trunk/Source/WebCore/Modules/webaudio/AudioBuffer.idl (265061 => 265062)


--- trunk/Source/WebCore/Modules/webaudio/AudioBuffer.idl	2020-07-29 22:00:20 UTC (rev 265061)
+++ trunk/Source/WebCore/Modules/webaudio/AudioBuffer.idl	2020-07-29 22:07:03 UTC (rev 265062)
@@ -40,4 +40,6 @@
     // Channel access
     readonly attribute unsigned long numberOfChannels;
     [MayThrowException] Float32Array getChannelData(unsigned long channelIndex);
+    [MayThrowException, EnabledBySetting=ModernUnprefixedWebAudio] void copyFromChannel(Float32Array destination, unsigned long channelNumber, optional unsigned long bufferOffset = 0);
+    [MayThrowException, EnabledBySetting=ModernUnprefixedWebAudio] void copyToChannel(Float32Array source, unsigned long channelNumber, optional unsigned long bufferOffset = 0);
 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to