-
Notifications
You must be signed in to change notification settings - Fork 473
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
Add buffer read to AudioBufferManager
and I2S
.
#2777
Conversation
libraries/I2S/examples/I2SLoopback_Buffer/I2SLoopback_Buffer.ino
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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!
libraries/I2S/examples/I2SLoopback_Buffer/I2SLoopback_Buffer.ino
Outdated
Show resolved
Hide resolved
@earlephilhower Everything should be good to go now. Thanks for the review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thx!
@earlephilhower Thanks for catching that last |
No worries. C casting footgun avoided. Probably others in my code still lurking... Thanks again! |
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:
size_t I2S::write(const uint8_t *buffer, size_t size)
. I'm good with having that function and the newsize_t I2S::write(const uint8_t *buffer, size_t size)
return the number of words written. But to match the nature of thesize_t size
argument (size in bytes), the return could be scaled bysizeof(uint32_t)
.