Conversation
packages/react-native-audio-api/common/cpp/audioapi/utils/AudioArray.h
Outdated
Show resolved
Hide resolved
packages/react-native-audio-api/common/cpp/audioapi/utils/AudioArray.h
Outdated
Show resolved
Hide resolved
| [[nodiscard]] float maxAbsValue() const; | ||
|
|
||
| private: | ||
| std::vector<std::shared_ptr<AudioArray>> channels_; |
There was a problem hiding this comment.
do we ever need this to be shared_ptr ???. As far as i know we use shared_ptr<AudioBus>.
This introduces some kind of triple pointer because vector is a pointer to shared ptr which are pointers to AudioArray which is pointer to data.
We might keep 2 implementations of AudioArray one being SharedAudioArray and it can keep shared_ptr<float[]> if we really need this cross thread sharing
There was a problem hiding this comment.
I will consider it in follow-up PR
packages/react-native-audio-api/common/cpp/audioapi/utils/AudioBus.h
Outdated
Show resolved
Hide resolved
packages/react-native-audio-api/common/cpp/audioapi/utils/AudioArray.cpp
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
This PR performs a major internal refactoring of the audio utilities layer, consolidating the dual-class AudioBus/AudioBuffer system into a single AudioBuffer class and modernizing the AudioArray implementation. The changes improve memory safety through smart pointers, add modern C++ features like spans and move semantics, and convert several utility classes to header-only implementations for better optimization.
Changes:
- Renamed
AudioBustoAudioBufferthroughout the entire codebase - Enhanced
AudioArraywith move semantics, span support, iterator support, and new utility methods - Introduced
AudioArrayBufferas a JSI-compatible buffer type - Converted Windows, AudioUtils, and ParamChangeEvent to header-only implementations
- Modernized memory management from raw pointers to smart pointers
Reviewed changes
Copilot reviewed 125 out of 125 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| AudioBuffer.h/cpp | New consolidated audio buffer implementation with improved API |
| AudioArray.h/cpp | Enhanced with modern C++, span support, and additional utility methods |
| AudioArrayBuffer.hpp | New JSI-compatible buffer adapter |
| All *Node files | Updated to use AudioBuffer and reference-based APIs |
| Test files | Updated to use new span-based APIs |
| Windows.hpp | Converted to header-only with span support |
| AudioUtils.hpp | Converted to header-only with inline implementations |
| ParamChangeEvent.hpp | Converted to header-only with inline constructor |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ca07daf to
a87f2f7
Compare
Closes #
Introduced changes
AudioArrayandAudioBus.AudioBusandAudioBufferinto one classMain goal of above changes is to introduce some kind of unification in operating on audio data. From today we should only use
AudioArrayas an abstraction over pcm channel data andAudioBufferas vector of channels.Rules:
Checklist