Skip to content

refactor: implemented aligned audio array implementation#980

Open
maciejmakowski2003 wants to merge 6 commits intomainfrom
refactor/aligned-audio-array
Open

refactor: implemented aligned audio array implementation#980
maciejmakowski2003 wants to merge 6 commits intomainfrom
refactor/aligned-audio-array

Conversation

@maciejmakowski2003
Copy link
Collaborator

@maciejmakowski2003 maciejmakowski2003 commented Mar 10, 2026

Part of RNAA-425

⚠️ Breaking changes ⚠️

Introduced changes

  • Implemented template class AlignedAudioArray that allows to specify alignment used to allocate it's data. There are two default template instantiations: AudioArray aligned to alignof(std::max_align_t) - in common 16 bytes, DSPAudioArray aligned to 64 bytes in order to avoid false sharing and boost SIMD.
  • Implemented template class AlignedAudioBuffer that is a wrapper around a vector of AlignedAudioArray.

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

@maciejmakowski2003 maciejmakowski2003 changed the title refactor: implmented aligned audio array implementation refactor: implemented aligned audio array implementation Mar 11, 2026
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 refactors AudioArray and AudioBuffer from traditional .h/.cpp class pairs into C++ template header-only (.hpp) implementations, introducing configurable memory alignment via the AlignedAudioArray<Alignment> and AlignedAudioBuffer<Alignment> template classes. Type aliases preserve backward compatibility (AudioArray, AudioBuffer) while adding new DSPAudioArray and DSPAudioBuffer types with 64-byte alignment for SIMD optimization.

Changes:

  • Replaced AudioArray.h/.cpp and AudioBuffer.h/.cpp with template header-only AudioArray.hpp and AudioBuffer.hpp, parameterized on memory alignment.
  • Updated all #include directives and removed now-unnecessary forward declarations (class AudioBuffer;, class AudioArray;) across ~50 files.
  • Fixed a typo in AudioAPIModuleInstaller.h renaming getCrateAudioBufferFunction to getCreateAudioBufferFunction.

Reviewed changes

Copilot reviewed 102 out of 103 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
AudioArray.hpp New template header replacing AudioArray.h/.cpp with alignment-parameterized AlignedAudioArray<Alignment>
AudioBuffer.hpp New template header replacing AudioBuffer.h/.cpp with alignment-parameterized AlignedAudioBuffer<Alignment>
AudioArrayBuffer.hpp Updated to use templatized AlignedAudioArrayBuffer<Alignment> inheriting from AlignedAudioArray
AudioArray.h/.cpp Deleted (replaced by .hpp)
AudioBuffer.h/.cpp Deleted (replaced by .hpp)
AudioAPIModuleInstaller.h Fixed function name typo (getCrate...getCreate...)
~40 other .h/.cpp/.mm files Updated includes from .h to .hpp and removed stale forward declarations
create-your-own-effect.mdx Updated documentation with new include paths

💡 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants