From 044da88de8d79c07412d6bdb765f54b50c3ca95f Mon Sep 17 00:00:00 2001 From: maciejmakowski2003 Date: Wed, 8 Oct 2025 12:43:49 +0200 Subject: [PATCH 1/8] fix: tryin to fix audio array buffer --- apps/fabric-example/ios/Podfile.lock | 2 +- .../sources/AudioBufferHostObject.cpp | 11 ++--- .../cpp/audioapi/core/effects/WorkletNode.cpp | 41 ++++++------------- .../cpp/audioapi/core/effects/WorkletNode.h | 5 +-- .../core/effects/WorkletProcessingNode.cpp | 11 +++-- .../cpp/audioapi/core/sources/AudioBuffer.h | 2 + .../core/sources/WorkletSourceNode.cpp | 5 +-- .../cpp/audioapi/jsi/AudioArrayBuffer.cpp | 4 +- .../cpp/audioapi/jsi/AudioArrayBuffer.h | 21 +++++----- .../common/cpp/audioapi/utils/AudioBus.cpp | 4 ++ .../common/cpp/audioapi/utils/AudioBus.h | 1 + 11 files changed, 45 insertions(+), 62 deletions(-) diff --git a/apps/fabric-example/ios/Podfile.lock b/apps/fabric-example/ios/Podfile.lock index 27581fcc1..976f3e436 100644 --- a/apps/fabric-example/ios/Podfile.lock +++ b/apps/fabric-example/ios/Podfile.lock @@ -3081,7 +3081,7 @@ SPEC CHECKSUMS: ReactAppDependencyProvider: c91900fa724baee992f01c05eeb4c9e01a807f78 ReactCodegen: 8125d6ee06ea06f48f156cbddec5c2ca576d62e6 ReactCommon: 116d6ee71679243698620d8cd9a9042541e44aa6 - RNAudioAPI: e08a4157527a2e87879a7bb61880276a0dfc77f6 + RNAudioAPI: d86d59666cfd7544d3cb0030239dc698404fe117 RNGestureHandler: 3a73f098d74712952870e948b3d9cf7b6cae9961 RNReanimated: a035264789d1f64cb5adba7085d6aac6e9ec70a7 RNScreens: 6ced6ae8a526512a6eef6e28c2286e1fc2d378c3 diff --git a/packages/react-native-audio-api/common/cpp/audioapi/HostObjects/sources/AudioBufferHostObject.cpp b/packages/react-native-audio-api/common/cpp/audioapi/HostObjects/sources/AudioBufferHostObject.cpp index a4f0d24d1..c12cf9074 100644 --- a/packages/react-native-audio-api/common/cpp/audioapi/HostObjects/sources/AudioBufferHostObject.cpp +++ b/packages/react-native-audio-api/common/cpp/audioapi/HostObjects/sources/AudioBufferHostObject.cpp @@ -1,6 +1,7 @@ #include #include +#include namespace audioapi { @@ -42,14 +43,8 @@ JSI_PROPERTY_GETTER_IMPL(AudioBufferHostObject, numberOfChannels) { JSI_HOST_FUNCTION_IMPL(AudioBufferHostObject, getChannelData) { auto channel = static_cast(args[0].getNumber()); - auto channelData = - reinterpret_cast(audioBuffer_->getChannelData(channel)); - auto length = static_cast(audioBuffer_->getLength()); - auto size = static_cast(length * sizeof(float)); - - // reading or writing from this ArrayBuffer could cause a crash - // if underlying channelData is deallocated - auto audioArrayBuffer = std::make_shared(channelData, size); + auto audioArrayBuffer = std::make_shared( + audioBuffer_->bus_->getSharedChannel(channel)); auto arrayBuffer = jsi::ArrayBuffer(runtime, audioArrayBuffer); auto float32ArrayCtor = diff --git a/packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletNode.cpp b/packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletNode.cpp index 3bc38c31e..c2e1f70db 100644 --- a/packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletNode.cpp +++ b/packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletNode.cpp @@ -9,25 +9,16 @@ WorkletNode::WorkletNode( size_t bufferLength, size_t inputChannelCount) : AudioNode(context), - buffRealLength_(bufferLength * sizeof(float)), - bufferLength_(bufferLength), workletRunner_(runtime), shareableWorklet_(worklet), + bufferLength_(bufferLength), inputChannelCount_(inputChannelCount), curBuffIndex_(0) { - buffs_.reserve(inputChannelCount_); - for (size_t i = 0; i < inputChannelCount_; ++i) { - buffs_.emplace_back(new uint8_t[buffRealLength_]); - } + bus_ = std::make_shared( + bufferLength, context->getSampleRate(), inputChannelCount); isInitialized_ = true; } -WorkletNode::~WorkletNode() { - for (auto &buff : buffs_) { - delete[] buff; - } -} - std::shared_ptr WorkletNode::processNode( const std::shared_ptr &processingBus, int framesToProcess) { @@ -40,17 +31,11 @@ std::shared_ptr WorkletNode::processNode( size_t needsToProcess = framesToProcess - processed; size_t shouldProcess = std::min(framesToWorkletInvoke, needsToProcess); - for (size_t ch = 0; ch < channelCount_; ch++) { - /// here we copy - /// to uint8_t* [curBuffIndex_, curBuffIndex_ + shouldProcess] - /// from float* [processed, processed + shouldProcess] - /// so as the we need to copy shouldProcess * sizeof(float) bytes - auto channelData = processingBus->getChannel(ch)->getData(); - std::memcpy( - /* dest */ buffs_[ch] + curBuffIndex_ * sizeof(float), - /* src */ reinterpret_cast(channelData + processed), - /* size */ shouldProcess * sizeof(float)); - } + /// here we copy + /// to [curBuffIndex_, curBuffIndex_ + shouldProcess] + /// from [processed, processed + shouldProcess] + bus_->copy(processingBus.get(), processed, curBuffIndex_, shouldProcess); + processed += shouldProcess; curBuffIndex_ += shouldProcess; @@ -63,16 +48,16 @@ std::shared_ptr WorkletNode::processNode( /// Arguments preparation auto jsArray = jsi::Array(uiRuntimeRaw, channelCount_); for (size_t ch = 0; ch < channelCount_; ch++) { - uint8_t *buffPtr = buffs_[ch]; - buffs_[ch] = new uint8_t[buffRealLength_]; + auto audioArray = std::make_shared(bufferLength_); + audioArray->copy(bus_->getChannel(ch)); auto sharedAudioArray = - std::make_shared(buffPtr, buffRealLength_); + std::make_shared(audioArray); auto arrayBuffer = jsi::ArrayBuffer(uiRuntimeRaw, std::move(sharedAudioArray)); jsArray.setValueAtIndex(uiRuntimeRaw, ch, std::move(arrayBuffer)); } - jsArray.setExternalMemoryPressure( - uiRuntimeRaw, channelCount_ * buffRealLength_); + + bus_->zero(); workletRunner_.executeWorklet( shareableWorklet_, diff --git a/packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletNode.h b/packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletNode.h index 4832109df..0027c11ce 100644 --- a/packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletNode.h +++ b/packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletNode.h @@ -42,7 +42,7 @@ class WorkletNode : public AudioNode { size_t inputChannelCount ); - ~WorkletNode() override; + ~WorkletNode() override = default; protected: std::shared_ptr processNode(const std::shared_ptr& processingBus, int framesToProcess) override; @@ -51,10 +51,9 @@ class WorkletNode : public AudioNode { private: WorkletsRunner workletRunner_; std::shared_ptr shareableWorklet_; - std::vector buffs_; + std::shared_ptr bus_; /// @brief Length of the byte buffer that will be passed to the AudioArrayBuffer - size_t buffRealLength_; size_t bufferLength_; size_t inputChannelCount_; size_t curBuffIndex_; diff --git a/packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletProcessingNode.cpp b/packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletProcessingNode.cpp index 3827ff999..fea906784 100644 --- a/packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletProcessingNode.cpp +++ b/packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletProcessingNode.cpp @@ -16,13 +16,12 @@ WorkletProcessingNode::WorkletProcessingNode( outputBuffsHandles_.resize(maxChannelCount); for (size_t i = 0; i < maxChannelCount; ++i) { - auto inputBuff = new uint8_t[RENDER_QUANTUM_SIZE * sizeof(float)]; - inputBuffsHandles_[i] = std::make_shared( - inputBuff, RENDER_QUANTUM_SIZE * sizeof(float)); + auto inputAudioArray = std::make_shared(RENDER_QUANTUM_SIZE); + inputBuffsHandles_[i] = std::make_shared(inputAudioArray); - auto outputBuff = new uint8_t[RENDER_QUANTUM_SIZE * sizeof(float)]; - outputBuffsHandles_[i] = std::make_shared( - outputBuff, RENDER_QUANTUM_SIZE * sizeof(float)); + auto outputAudioArray = std::make_shared(RENDER_QUANTUM_SIZE); + outputBuffsHandles_[i] = + std::make_shared(outputAudioArray); } } diff --git a/packages/react-native-audio-api/common/cpp/audioapi/core/sources/AudioBuffer.h b/packages/react-native-audio-api/common/cpp/audioapi/core/sources/AudioBuffer.h index 22e04ce92..0e67c7b2a 100644 --- a/packages/react-native-audio-api/common/cpp/audioapi/core/sources/AudioBuffer.h +++ b/packages/react-native-audio-api/common/cpp/audioapi/core/sources/AudioBuffer.h @@ -10,6 +10,7 @@ namespace audioapi { class AudioBus; +class AudioBufferHostObject; class AudioBuffer : public std::enable_shared_from_this { public: @@ -37,6 +38,7 @@ class AudioBuffer : public std::enable_shared_from_this { private: friend class AudioBufferSourceNode; friend class AudioBufferQueueSourceNode; + friend class AudioBufferHostObject; std::shared_ptr bus_; }; diff --git a/packages/react-native-audio-api/common/cpp/audioapi/core/sources/WorkletSourceNode.cpp b/packages/react-native-audio-api/common/cpp/audioapi/core/sources/WorkletSourceNode.cpp index a9e230ea5..1e2cb2682 100644 --- a/packages/react-native-audio-api/common/cpp/audioapi/core/sources/WorkletSourceNode.cpp +++ b/packages/react-native-audio-api/common/cpp/audioapi/core/sources/WorkletSourceNode.cpp @@ -16,9 +16,8 @@ WorkletSourceNode::WorkletSourceNode( size_t outputChannelCount = this->getChannelCount(); outputBuffsHandles_.resize(outputChannelCount); for (size_t i = 0; i < outputChannelCount; ++i) { - auto buff = new uint8_t[RENDER_QUANTUM_SIZE * sizeof(float)]; - outputBuffsHandles_[i] = std::make_shared( - buff, RENDER_QUANTUM_SIZE * sizeof(float)); + auto audioArray = std::make_shared(RENDER_QUANTUM_SIZE); + outputBuffsHandles_[i] = std::make_shared(audioArray); } } diff --git a/packages/react-native-audio-api/common/cpp/audioapi/jsi/AudioArrayBuffer.cpp b/packages/react-native-audio-api/common/cpp/audioapi/jsi/AudioArrayBuffer.cpp index 85f4e8911..59bf02153 100644 --- a/packages/react-native-audio-api/common/cpp/audioapi/jsi/AudioArrayBuffer.cpp +++ b/packages/react-native-audio-api/common/cpp/audioapi/jsi/AudioArrayBuffer.cpp @@ -3,11 +3,11 @@ namespace audioapi { size_t AudioArrayBuffer::size() const { - return size_; + return audioArray_->getSize() * sizeof(float); } uint8_t *AudioArrayBuffer::data() { - return data_; + return reinterpret_cast(audioArray_->getData()); } } // namespace audioapi diff --git a/packages/react-native-audio-api/common/cpp/audioapi/jsi/AudioArrayBuffer.h b/packages/react-native-audio-api/common/cpp/audioapi/jsi/AudioArrayBuffer.h index 7d36549f0..9c5a07df2 100644 --- a/packages/react-native-audio-api/common/cpp/audioapi/jsi/AudioArrayBuffer.h +++ b/packages/react-native-audio-api/common/cpp/audioapi/jsi/AudioArrayBuffer.h @@ -1,6 +1,10 @@ #pragma once #include +#include + +#include +#include namespace audioapi { @@ -8,16 +12,12 @@ using namespace facebook; class AudioArrayBuffer : public jsi::MutableBuffer { public: - AudioArrayBuffer(uint8_t *data, size_t size): data_(data), size_(size) {} - ~AudioArrayBuffer() override { - if (data_ == nullptr) { - return; - } - delete[] data_; - } + explicit AudioArrayBuffer(const std::shared_ptr &audioArray): audioArray_(audioArray) {} + ~AudioArrayBuffer() override = default; + AudioArrayBuffer(AudioArrayBuffer &&other) noexcept - : data_(other.data_), size_(other.size_) { - other.data_ = nullptr; + : audioArray_(std::move(other.audioArray_)) { + other.audioArray_ = nullptr; } AudioArrayBuffer(const AudioArrayBuffer &) = delete; @@ -28,8 +28,7 @@ class AudioArrayBuffer : public jsi::MutableBuffer { uint8_t *data() override; private: - uint8_t *data_; - const size_t size_; + std::shared_ptr audioArray_; }; } // namespace audioapi diff --git a/packages/react-native-audio-api/common/cpp/audioapi/utils/AudioBus.cpp b/packages/react-native-audio-api/common/cpp/audioapi/utils/AudioBus.cpp index 5f28b9c7f..dd7aaf8ea 100644 --- a/packages/react-native-audio-api/common/cpp/audioapi/utils/AudioBus.cpp +++ b/packages/react-native-audio-api/common/cpp/audioapi/utils/AudioBus.cpp @@ -128,6 +128,10 @@ AudioArray *AudioBus::getChannelByType(int channelType) const { } } +std::shared_ptr AudioBus::getSharedChannel(int index) const { + return channels_[index]; +} + AudioArray &AudioBus::operator[](size_t index) { return *channels_[index]; } diff --git a/packages/react-native-audio-api/common/cpp/audioapi/utils/AudioBus.h b/packages/react-native-audio-api/common/cpp/audioapi/utils/AudioBus.h index 8c75e1150..ca35788be 100644 --- a/packages/react-native-audio-api/common/cpp/audioapi/utils/AudioBus.h +++ b/packages/react-native-audio-api/common/cpp/audioapi/utils/AudioBus.h @@ -34,6 +34,7 @@ class AudioBus { [[nodiscard]] size_t getSize() const; [[nodiscard]] AudioArray *getChannel(int index) const; [[nodiscard]] AudioArray *getChannelByType(int channelType) const; + [[nodiscard]] std::shared_ptr getSharedChannel(int index) const; AudioArray &operator[](size_t index); const AudioArray &operator[](size_t index) const; From 15f9d1973a93d31b726ec2b81f9c0c2869d44beb Mon Sep 17 00:00:00 2001 From: maciejmakowski2003 Date: Wed, 8 Oct 2025 15:24:04 +0200 Subject: [PATCH 2/8] fix: fixed wrong ctor order --- .../common/cpp/audioapi/core/effects/WorkletNode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletNode.cpp b/packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletNode.cpp index c2e1f70db..870b1e035 100644 --- a/packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletNode.cpp +++ b/packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletNode.cpp @@ -15,7 +15,7 @@ WorkletNode::WorkletNode( inputChannelCount_(inputChannelCount), curBuffIndex_(0) { bus_ = std::make_shared( - bufferLength, context->getSampleRate(), inputChannelCount); + bufferLength, inputChannelCount, context->getSampleRate()); isInitialized_ = true; } From 09c58a38c6fffdcce92d37be9338981e1fa0e8e5 Mon Sep 17 00:00:00 2001 From: maciejmakowski2003 Date: Fri, 10 Oct 2025 16:24:34 +0200 Subject: [PATCH 3/8] fix: removed forward declaration --- .../common/cpp/audioapi/core/sources/AudioBuffer.h | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/react-native-audio-api/common/cpp/audioapi/core/sources/AudioBuffer.h b/packages/react-native-audio-api/common/cpp/audioapi/core/sources/AudioBuffer.h index 0e67c7b2a..019fb6861 100644 --- a/packages/react-native-audio-api/common/cpp/audioapi/core/sources/AudioBuffer.h +++ b/packages/react-native-audio-api/common/cpp/audioapi/core/sources/AudioBuffer.h @@ -10,7 +10,6 @@ namespace audioapi { class AudioBus; -class AudioBufferHostObject; class AudioBuffer : public std::enable_shared_from_this { public: From c36d8e7b6ffd1c541f54d34367993ae8c2e968d6 Mon Sep 17 00:00:00 2001 From: maciejmakowski2003 Date: Fri, 10 Oct 2025 16:25:14 +0200 Subject: [PATCH 4/8] fix: removed pragma once from source file??? --- .../cpp/audioapi/HostObjects/utils/AudioDecoderHostObject.cpp | 2 -- .../cpp/audioapi/HostObjects/utils/AudioStretcherHostObject.cpp | 2 -- 2 files changed, 4 deletions(-) diff --git a/packages/react-native-audio-api/common/cpp/audioapi/HostObjects/utils/AudioDecoderHostObject.cpp b/packages/react-native-audio-api/common/cpp/audioapi/HostObjects/utils/AudioDecoderHostObject.cpp index 050d24a2c..495fc2d8a 100644 --- a/packages/react-native-audio-api/common/cpp/audioapi/HostObjects/utils/AudioDecoderHostObject.cpp +++ b/packages/react-native-audio-api/common/cpp/audioapi/HostObjects/utils/AudioDecoderHostObject.cpp @@ -1,5 +1,3 @@ -#pragma once - #include #include #include diff --git a/packages/react-native-audio-api/common/cpp/audioapi/HostObjects/utils/AudioStretcherHostObject.cpp b/packages/react-native-audio-api/common/cpp/audioapi/HostObjects/utils/AudioStretcherHostObject.cpp index bf4942bcb..cc992deff 100644 --- a/packages/react-native-audio-api/common/cpp/audioapi/HostObjects/utils/AudioStretcherHostObject.cpp +++ b/packages/react-native-audio-api/common/cpp/audioapi/HostObjects/utils/AudioStretcherHostObject.cpp @@ -1,5 +1,3 @@ -#pragma once - #include #include #include From cef578bd5c60be5d36119003ccac7df147ddf918 Mon Sep 17 00:00:00 2001 From: maciejmakowski2003 Date: Fri, 10 Oct 2025 16:29:00 +0200 Subject: [PATCH 5/8] fix: revert set external memory pressure --- .../common/cpp/audioapi/core/effects/WorkletNode.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletNode.cpp b/packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletNode.cpp index 870b1e035..14c0416da 100644 --- a/packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletNode.cpp +++ b/packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletNode.cpp @@ -56,6 +56,7 @@ std::shared_ptr WorkletNode::processNode( jsi::ArrayBuffer(uiRuntimeRaw, std::move(sharedAudioArray)); jsArray.setValueAtIndex(uiRuntimeRaw, ch, std::move(arrayBuffer)); } + jsArray.setExternalMemoryPressure(uiRuntimeRaw, channelCount_ * bufferLength_ * sizeof(float)); bus_->zero(); From 0f8a441e7ef8f5fe19e106a8a1b303f7805fce56 Mon Sep 17 00:00:00 2001 From: maciejmakowski2003 Date: Fri, 10 Oct 2025 16:29:16 +0200 Subject: [PATCH 6/8] ci: lint --- .../common/cpp/audioapi/core/effects/WorkletNode.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletNode.cpp b/packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletNode.cpp index 14c0416da..66dc31139 100644 --- a/packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletNode.cpp +++ b/packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletNode.cpp @@ -56,7 +56,8 @@ std::shared_ptr WorkletNode::processNode( jsi::ArrayBuffer(uiRuntimeRaw, std::move(sharedAudioArray)); jsArray.setValueAtIndex(uiRuntimeRaw, ch, std::move(arrayBuffer)); } - jsArray.setExternalMemoryPressure(uiRuntimeRaw, channelCount_ * bufferLength_ * sizeof(float)); + jsArray.setExternalMemoryPressure( + uiRuntimeRaw, channelCount_ * bufferLength_ * sizeof(float)); bus_->zero(); From df234275427b1aadb3f1622a0efbbcb02e5c3427 Mon Sep 17 00:00:00 2001 From: maciejmakowski2003 Date: Mon, 13 Oct 2025 11:25:42 +0200 Subject: [PATCH 7/8] refactor: set external memory pressure on each element instead of whole array --- .../common/cpp/audioapi/core/effects/WorkletNode.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletNode.cpp b/packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletNode.cpp index 66dc31139..9859d28d4 100644 --- a/packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletNode.cpp +++ b/packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletNode.cpp @@ -54,10 +54,9 @@ std::shared_ptr WorkletNode::processNode( std::make_shared(audioArray); auto arrayBuffer = jsi::ArrayBuffer(uiRuntimeRaw, std::move(sharedAudioArray)); + arrayBuffer.setExternalMemoryPressure(uiRuntimeRaw, sharedAudioArray->size()); jsArray.setValueAtIndex(uiRuntimeRaw, ch, std::move(arrayBuffer)); } - jsArray.setExternalMemoryPressure( - uiRuntimeRaw, channelCount_ * bufferLength_ * sizeof(float)); bus_->zero(); From 065fa8953b41eb3adfaac63df85e6c16ccc45cc7 Mon Sep 17 00:00:00 2001 From: maciejmakowski2003 Date: Mon, 13 Oct 2025 11:26:02 +0200 Subject: [PATCH 8/8] ci: lint --- .../common/cpp/audioapi/core/effects/WorkletNode.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletNode.cpp b/packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletNode.cpp index 9859d28d4..a4b043825 100644 --- a/packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletNode.cpp +++ b/packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletNode.cpp @@ -54,7 +54,8 @@ std::shared_ptr WorkletNode::processNode( std::make_shared(audioArray); auto arrayBuffer = jsi::ArrayBuffer(uiRuntimeRaw, std::move(sharedAudioArray)); - arrayBuffer.setExternalMemoryPressure(uiRuntimeRaw, sharedAudioArray->size()); + arrayBuffer.setExternalMemoryPressure( + uiRuntimeRaw, sharedAudioArray->size()); jsArray.setValueAtIndex(uiRuntimeRaw, ch, std::move(arrayBuffer)); }