Skip to content

Refactor: use a single buffer reader for all sample playback nodes#76

Merged
nick-thompson merged 14 commits into
elemaudio:developfrom
steve-mackinnon:shared-buffer-reader
Jan 9, 2026
Merged

Refactor: use a single buffer reader for all sample playback nodes#76
nick-thompson merged 14 commits into
elemaudio:developfrom
steve-mackinnon:shared-buffer-reader

Conversation

@steve-mackinnon

Copy link
Copy Markdown

This splits out a shared utility called BufferReader that handles the sample reading portion of the various sample nodes, and updates the samples nodes to use it in place of custom implementations.

BufferReader handles:

  • Interpolated sample reading
  • Triggering
  • Looping
  • Start and end trimming of the source sample
  • Fading audio in and out when playback starts and stops

@nick-thompson nick-thompson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is great, thank you!


// Note: this is set to 1.1 ms to preserve backwards compatibility. Historically, a gain fade with
// a step size of 0.02 was used for SampleSeqNode, which comes out to roughly 1.1 ms at 44100 Hz.
static constexpr double FadeTime = 1.1;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

😅 that certainly wasn't intentional

@nick-thompson nick-thompson merged commit 364015a into elemaudio:develop Jan 9, 2026
4 checks passed
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.

2 participants