Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add buffer read to AudioBufferManager and I2S. #2777

Merged
merged 6 commits into from
Jan 26, 2025

Conversation

relic-se
Copy link
Contributor

I quickly noticed after our discussion in #2775 that a buffered read was not available in the I2S library or the AudioBufferManager. I've added the necessary functionality to do this as well as a second loopback example demonstrating how to properly implement it. The documentation has also been updated with this method.

Notes:

  • I have noticed performance improvements with this feature properly implemented.
  • I've fixed an error in the documentation regarding the return value of size_t I2S::write(const uint8_t *buffer, size_t size). I'm good with having that function and the new size_t I2S::write(const uint8_t *buffer, size_t size) return the number of words written. But to match the nature of the size_t size argument (size in bytes), the return could be scaled by sizeof(uint32_t).

Copy link
Owner

@earlephilhower earlephilhower left a comment

Choose a reason for hiding this comment

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

Minor const question, but OTW thanks very much for the contribution! I focused my effort on making the output path faster since I use it for https://github.com/earlephilhower/BackgroundAudio and https://github.com/earlephilhower/ESP8266Audio so you're hitting these bottlenecks. Thx again for taking the time to help alleviate them!

docs/i2s.rst Outdated Show resolved Hide resolved
libraries/I2S/src/I2S.cpp Outdated Show resolved Hide resolved
@relic-se
Copy link
Contributor Author

@earlephilhower Everything should be good to go now. Thanks for the review!

Copy link
Owner

@earlephilhower earlephilhower left a comment

Choose a reason for hiding this comment

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

Great, thx!

@earlephilhower earlephilhower merged commit a426fbf into earlephilhower:master Jan 26, 2025
26 checks passed
@relic-se
Copy link
Contributor Author

@earlephilhower Thanks for catching that last const!

@earlephilhower
Copy link
Owner

No worries. C casting footgun avoided. Probably others in my code still lurking... Thanks again!

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