-
Notifications
You must be signed in to change notification settings - Fork 38
Description
Due to my inexperience at the time, our AudioSDWriter_F32
and AudioSDPlayer_F32
are not well designed. Among their many problems is that they access the SD card via the SdFs
library instead of the Teensy/Arduino standard SD
library. I think that we should move these two classes (and SDWriter
underneath) to use the more-standard SD
library.
Problems with the current SdFs
-based implementation include:
-
Confusion over how to best handle the fact that both AudioSDWriter and AudioSDPlayer want to access the SD card. I think that we've worked it out by using a pointer to the same underlying SdFs instance, but I'm not sure it's as good as using the singleton that is
SD
. -
By using SdFs directly, we can't use features that are written specifically at the level of
SD
. In this case, I 'm speaking mostly about the ability to see if an SD card is present. There may also be additionalSD
-only capabilities that I'm not familiar with.
The biggest argument to keep the SdFs
-based implementation (besides the fact that it exists and that it seems to work) is that SdFs
generally has lots more capabilities. Luckily, even if we move to SD
, you can still ask SD
for the SdFs
underneath via SD.sdfs
. So, we'd be good! Sadly, AFAIK you can't do the reverse; you can't ask for the singleton SD
object from our SdFs
instance.
Besides just being a more standard implementation, moving to SD
provides these benefits:
-
We can easily wrap
SD
so that we can be sure we only callSD.begin()
once, which is the real problem with trying to detect the SD card. -
To learn how to use the SD subsystem better, we only have to read through the far-more-simple SD Library and not the crazy-complicated SdFs library (aka SdFat).
Our inability to make continuous improvements to Tympan's SD capability is in large part due to the difficulty of understanding SdFs
. I think that moving to SD
would make everything more clear and easier.