Make AudioPlaySdWav object honour the value of AUDIO_BLOCK_SAMPLES#448
Make AudioPlaySdWav object honour the value of AUDIO_BLOCK_SAMPLES#448h4yn0nnym0u5e wants to merge 2 commits intoPaulStoffregen:masterfrom
Conversation
Loads either one SD card sector / 512 bytes, or two blocks' worth (to allow for stereo playback) if AUDIO_BLOCK_SAMPLES is set to >128. Minor change to play_sd_raw.cpp to remove magic number.
|
This is pretty much what I came to github to find, except I wanted to remove the magic number in play_sd_wav.h |
But it's necessary to understand SD card sectors and the If you've successfully used this in your code, please report back - I'd like to know it works for you, even if at nearly 3 years old the prospect of it getting pulled in seems remote. Do note that you're unlikely get more than a couple of files playing back at once, as the design of this object is pretty poor, accessing the SD card inside an interrupt. |
|
If you were to redesign this object from the ground up, what would that look like? |
|
Very much like this PR. Yes, it uses more memory, and needs a bit of extra setup, but it seems to work well. Precautions are needed around other SD access, because SdFat calls See also the discussion thread here. |
Loads either one SD card sector / 512 bytes, or two blocks' worth (to allow for stereo playback) if AUDIO_BLOCK_SAMPLES is set to >128. Minor change to play_sd_raw.cpp to remove magic number.
Very simple update, no (intentional!) change in behaviour with standard library settings.