Added copyFromChannel, copyToChannel methods to AudioBuffer according to spec: https://www.w3.org/TR/webaudio/#dom-audiobuffer-copyfromchannel-destination.
Created attachment 405477 [details] Patch
Comment on attachment 405477 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=405477&action=review > Source/WebCore/Modules/webaudio/AudioBuffer.h:57 > + ExceptionOr<void> copyFromChannel(Ref<Float32Array>, size_t channelNumber, size_t bufferOffset); > + ExceptionOr<void> copyToChannel(Ref<Float32Array>, size_t channelNumber, size_t startInChannel); Ref<Float32Array> is not the correct argument type; creates unnecessary reference count churn. Ref<Float32Array>&& is better.
Comment on attachment 405477 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=405477&action=review > Source/WebCore/Modules/webaudio/AudioBuffer.cpp:128 > +ExceptionOr<void> AudioBuffer::copyFromChannel(Ref<Float32Array> destination, size_t channelNumber, size_t bufferOffset) Ref<Float32Array>&&. It may be a good idea to use unsigned type for the other parameters, to match the IDL > Source/WebCore/Modules/webaudio/AudioBuffer.cpp:130 > + if (destination.get().isShared()) destination->isShared() > Source/WebCore/Modules/webaudio/AudioBuffer.cpp:134 > + return Exception { IndexSizeError, "channelNumber is out of index."_s }; "out of index" ? > Source/WebCore/Modules/webaudio/AudioBuffer.cpp:147 > + float* dst = destination.get().data(); destination->data() > Source/WebCore/Modules/webaudio/AudioBuffer.cpp:156 > +ExceptionOr<void> AudioBuffer::copyToChannel(Ref<Float32Array> source, size_t channelNumber, size_t bufferOffset) Ref<Float32Array>&& and unsigned for others. > Source/WebCore/Modules/webaudio/AudioBuffer.cpp:162 > + return Exception { IndexSizeError, "channelNumber is out of index."_s }; "out of index"?
Created attachment 405491 [details] Patch
Created attachment 405498 [details] Patch
New patch includes a re-baselined test that incorporates new ExceptionError message.
Committed r265062: <https://trac.webkit.org/changeset/265062> All reviewed patches have been landed. Closing bug and clearing flags on attachment 405498 [details].
<rdar://problem/66294740>