Processing data with a C++ Turbo Module and WorkletProcessingNode

1 day ago 4
ARTICLE AD BOX

I am doing some real-time audio processing in react-native, using a C++ turbo module. What kind of data type do I need to send chunks of data from a worklet function to the C++ module? Since JavaScript doesn't have pointers I have tried to send the data using array types, but this crashes the app with no visible error as soon as foo is called.

App.tsx

let output = outputData[ch]; const input = Array.from(inputData[ch]); output.set(TurboModule.foo(input));

NativeModule.cpp

std::array<float, 128> NativeSampleModule::foo(jsi::Runtime& rt, std::array<float, 128> input) { return input; }

Is there a better way to send arrays between these processes? Or some way to use JavaScript object references like pointers? It is essential that I process that data in chunks in C/C++.

Read Entire Article