Skip to content

Refactor/internal tools#932

Draft
maciejmakowski2003 wants to merge 23 commits intomainfrom
refactor/internal-tools
Draft

Refactor/internal tools#932
maciejmakowski2003 wants to merge 23 commits intomainfrom
refactor/internal-tools

Conversation

@maciejmakowski2003
Copy link
Collaborator

@maciejmakowski2003 maciejmakowski2003 commented Feb 2, 2026

Closes #

⚠️ Breaking changes ⚠️

Introduced changes

  • Refactored AudioArray and AudioBus.
  • Merged AudioBus and AudioBuffer into one class

Main goal of above changes is to introduce some kind of unification in operating on audio data. From today we should only use AudioArray as an abstraction over pcm channel data and AudioBuffer as vector of channels.

Rules:

  • Do not break the chain -> operate over AudioArray / AudioBuffer.
  • Raw float pointer can be used only while integrating with external systems/services/interfaces like: JSI, native player, native recorder, decoders, encoders etc.
  • Do not create other data structures without prior checking whether any existing can be used directly or as a parent class.

Checklist

  • Linked relevant issue
  • Updated relevant documentation
  • Added/Conducted relevant tests
  • Performed self-review of the code
  • Updated Web Audio API coverage
  • Added support for web
  • Updated old arch android spec file

[[nodiscard]] float maxAbsValue() const;

private:
std::vector<std::shared_ptr<AudioArray>> channels_;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will consider it in follow-up PR

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 AudioBus to AudioBuffer throughout the entire codebase
  • Enhanced AudioArray with move semantics, span support, iterator support, and new utility methods
  • Introduced AudioArrayBuffer as 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants