Skip to content

Add buffer read to AudioBufferManager and I2S. #2777

New issue

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

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

Already on GitHub? # to your account

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!

@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!

@relic-se relic-se deleted the i2s_read_buffer branch February 3, 2025 21:15
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants