refactor: integrated DSPAudioBuffer and DSPAudioArray into codebase#985
Open
maciejmakowski2003 wants to merge 3 commits intorefactor/aligned-audio-arrayfrom
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors the audio processing pipeline to standardize on SIMD-friendly DSPAudioBuffer/DSPAudioArray types and modernizes supporting utilities (circular buffers, resampler) across iOS, Android, core DSP, tests, and documentation/templates.
Changes:
- Replace many
AudioBuffer/AudioArrayprocessing paths withDSPAudioBuffer/DSPAudioArrayequivalents across nodes and DSP utilities. - Replace legacy
CircularAudioArraywith a templatedCircularArrayutility and migrate includes/usages. - Convert the r8brain resampler wrapper to a header-only
Resampler.hppand update call sites; refresh tests/docs/templates accordingly.
Reviewed changes
Copilot reviewed 94 out of 94 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/react-native-audio-api/ios/audioapi/ios/core/utils/IOSRecorderCallback.mm | Update circular buffer include to new header |
| packages/react-native-audio-api/ios/audioapi/ios/core/utils/IOSRecorderCallback.h | Remove obsolete forward declaration |
| packages/react-native-audio-api/ios/audioapi/ios/core/IOSAudioRecorder.mm | Update circular buffer include to new header |
| packages/react-native-audio-api/ios/audioapi/ios/core/IOSAudioPlayer.mm | Switch render callback/buffer to DSPAudioBuffer |
| packages/react-native-audio-api/ios/audioapi/ios/core/IOSAudioPlayer.h | Switch render callback/buffer to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/test/src/core/sources/ConstantSourceTest.cpp | Update tests to use DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/test/src/core/sources/AudioScheduledSourceTest.cpp | Update tests to use DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/test/src/core/effects/WaveShaperNodeTest.cpp | Update tests to use DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/test/src/core/effects/StereoPannerTest.cpp | Update tests to use DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/test/src/core/effects/GainTest.cpp | Update tests to use DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/test/src/core/effects/DelayTest.cpp | Update tests to use DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/utils/CircularAudioArray.h | Remove legacy circular audio array header |
| packages/react-native-audio-api/common/cpp/audioapi/utils/CircularAudioArray.cpp | Remove legacy circular audio array implementation |
| packages/react-native-audio-api/common/cpp/audioapi/utils/CircularArray.hpp | Add templated circular array replacement |
| packages/react-native-audio-api/common/cpp/audioapi/utils/AudioBuffer.hpp | Allow cross-alignment copy/sum; keep aliases |
| packages/react-native-audio-api/common/cpp/audioapi/utils/AudioArrayBuffer.hpp | Adjust alignment template + test dummy base |
| packages/react-native-audio-api/common/cpp/audioapi/utils/AudioArray.hpp | Fix typo; keep DSP/standard aliases |
| packages/react-native-audio-api/common/cpp/audioapi/dsp/r8brain/Resampler.hpp | Add header-only resampler wrapper |
| packages/react-native-audio-api/common/cpp/audioapi/dsp/r8brain/Resampler.h | Remove legacy resampler header |
| packages/react-native-audio-api/common/cpp/audioapi/dsp/r8brain/Resampler.cpp | Remove legacy resampler implementation |
| packages/react-native-audio-api/common/cpp/audioapi/dsp/WaveShaper.h | Switch processing buffers to DSPAudioArray |
| packages/react-native-audio-api/common/cpp/audioapi/dsp/WaveShaper.cpp | Switch internal temps + processing to DSPAudioArray |
| packages/react-native-audio-api/common/cpp/audioapi/dsp/FFT.h | Generalize FFT APIs to aligned arrays |
| packages/react-native-audio-api/common/cpp/audioapi/dsp/Convolver.h | Switch processing buffers to DSPAudioArray |
| packages/react-native-audio-api/common/cpp/audioapi/dsp/Convolver.cpp | Switch internal buffers + processing to DSPAudioArray |
| packages/react-native-audio-api/common/cpp/audioapi/core/utils/AudioRecorderCallback.h | Include new circular array header; cleanup decls |
| packages/react-native-audio-api/common/cpp/audioapi/core/utils/AudioRecorderCallback.cpp | Update circular buffer include to new header |
| packages/react-native-audio-api/common/cpp/audioapi/core/sources/WorkletSourceNode.h | Switch node processing to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/sources/WorkletSourceNode.cpp | Switch node processing to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/sources/StreamerNode.h | Switch resampler include + processing to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/sources/StreamerNode.cpp | Switch processing + internal buffer to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/sources/RecorderAdapterNode.h | Switch processing signature to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/sources/RecorderAdapterNode.cpp | Switch processing signature to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/sources/OscillatorNode.h | Switch processing signature to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/sources/OscillatorNode.cpp | Switch processing signature to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/sources/ConstantSourceNode.h | Switch processing signature to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/sources/ConstantSourceNode.cpp | Switch processing signature to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/sources/AudioScheduledSourceNode.h | Update updatePlaybackInfo buffer type |
| packages/react-native-audio-api/common/cpp/audioapi/core/sources/AudioScheduledSourceNode.cpp | Update updatePlaybackInfo buffer type |
| packages/react-native-audio-api/common/cpp/audioapi/core/sources/AudioBufferSourceNode.h | Switch processing + rate/audio buffers to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/sources/AudioBufferSourceNode.cpp | Switch processing signatures; adjust buffer lifecycle notes |
| packages/react-native-audio-api/common/cpp/audioapi/core/sources/AudioBufferQueueSourceNode.h | Switch processing signatures to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/sources/AudioBufferQueueSourceNode.cpp | Switch processing signatures to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/sources/AudioBufferBaseSourceNode.h | Switch playback rate buffer to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/sources/AudioBufferBaseSourceNode.cpp | Initialize playback rate buffer as DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/inputs/AudioRecorder.h | Remove obsolete forward declaration |
| packages/react-native-audio-api/common/cpp/audioapi/core/inputs/AudioRecorder.cpp | Minor cleanup in includes/formatting |
| packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletProcessingNode.h | Switch processing signature to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletProcessingNode.cpp | Switch processing signature; adjust time type |
| packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletNode.h | Switch processing signature to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletNode.cpp | Switch processing signature to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/effects/WaveShaperNode.h | Switch processing signature to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/effects/WaveShaperNode.cpp | Switch processing signature to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/effects/StereoPannerNode.h | Switch processing signature to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/effects/StereoPannerNode.cpp | Switch processing signature to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/effects/PeriodicWave.h | Switch wavetable storage to DSP types |
| packages/react-native-audio-api/common/cpp/audioapi/core/effects/PeriodicWave.cpp | Switch band-limited tables to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/effects/IIRFilterNode.h | Switch processing signature + indices array to DSP |
| packages/react-native-audio-api/common/cpp/audioapi/core/effects/IIRFilterNode.cpp | Switch processing signature to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/effects/GainNode.h | Switch processing signature to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/effects/GainNode.cpp | Switch processing signature to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/effects/DelayNode.h | Switch processing signature to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/effects/DelayNode.cpp | Switch processing signature to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/effects/ConvolverNode.h | Switch internal/intermediate buffers + processing to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/effects/ConvolverNode.cpp | Switch internal/intermediate buffers + processing to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/effects/BiquadFilterNode.h | Switch delay line arrays to DSPAudioArray |
| packages/react-native-audio-api/common/cpp/audioapi/core/effects/BiquadFilterNode.cpp | Switch processing signature to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/destinations/AudioDestinationNode.h | Switch render/process signatures to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/destinations/AudioDestinationNode.cpp | Switch render signature to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/analysis/AnalyserNode.h | Switch analysis buffers to DSP types + new circular array |
| packages/react-native-audio-api/common/cpp/audioapi/core/analysis/AnalyserNode.cpp | Switch analysis buffers to DSP types + new circular array |
| packages/react-native-audio-api/common/cpp/audioapi/core/OfflineAudioContext.h | Add DSP render buffer + const members |
| packages/react-native-audio-api/common/cpp/audioapi/core/OfflineAudioContext.cpp | Use persistent DSP render buffer; copy into result |
| packages/react-native-audio-api/common/cpp/audioapi/core/BaseAudioContext.h | Remove now-unneeded AudioBuffer include |
| packages/react-native-audio-api/common/cpp/audioapi/core/BaseAudioContext.cpp | Update circular buffer include to new header |
| packages/react-native-audio-api/common/cpp/audioapi/core/AudioParam.h | Switch a-rate processing buffers to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/AudioParam.cpp | Allocate/process a-rate params using DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/AudioNode.h | Switch node processing pipeline to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/AudioNode.cpp | Allocate/process node buffers using DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/AudioContext.h | Update render callback type to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/core/AudioContext.cpp | Update render callback type to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/HostObjects/sources/AudioBufferSourceNodeHostObject.cpp | Switch internal buffers to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/HostObjects/effects/WaveShaperNodeHostObject.cpp | Update curve handling to AudioArray copy |
| packages/react-native-audio-api/common/cpp/audioapi/HostObjects/effects/ConvolverNodeHostObject.cpp | Switch internal buffers to DSPAudioBuffer |
| packages/react-native-audio-api/common/cpp/audioapi/AudioAPIModuleInstaller.h | Fix exported JS prop name for createAudioBuffer |
| packages/react-native-audio-api/android/src/main/cpp/audioapi/android/core/utils/AndroidRecorderCallback.h | Remove obsolete forward declaration |
| packages/react-native-audio-api/android/src/main/cpp/audioapi/android/core/utils/AndroidRecorderCallback.cpp | Update circular buffer include to new header |
| packages/react-native-audio-api/android/src/main/cpp/audioapi/android/core/AudioPlayer.h | Switch render callback/buffer to DSPAudioBuffer |
| packages/react-native-audio-api/android/src/main/cpp/audioapi/android/core/AudioPlayer.cpp | Switch render callback/buffer to DSPAudioBuffer |
| packages/react-native-audio-api/android/src/main/cpp/audioapi/android/core/AndroidAudioRecorder.h | Remove obsolete forward declaration |
| packages/react-native-audio-api/android/src/main/cpp/audioapi/android/core/AndroidAudioRecorder.cpp | Update circular buffer include to new header |
| packages/custom-node-generator/templates/basic/shared/MyProcessorNode.h | Update template node signature to DSPAudioBuffer |
| packages/custom-node-generator/templates/basic/shared/MyProcessorNode.cpp | Update template node signature to DSPAudioBuffer |
| packages/audiodocs/docs/guides/create-your-own-effect.mdx | Update docs example to DSPAudioBuffer signatures |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/react-native-audio-api/common/cpp/audioapi/utils/CircularArray.hpp
Show resolved
Hide resolved
packages/react-native-audio-api/common/cpp/audioapi/core/sources/AudioBufferSourceNode.cpp
Show resolved
Hide resolved
packages/react-native-audio-api/common/cpp/audioapi/core/effects/ConvolverNode.cpp
Show resolved
Hide resolved
…a-structures-integration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #
Introduced changes
AlignedAudioArrayandAlignedAudioBuffertemplate instantiations into codebase.CircularAudioArraywithCircularArraytemplate classChecklist