I’m not sure I’d call
BeepPin2 particularly abstract, they’re just collections of static functions.
If they were both responsible for implementing what
Arduboy2Audio::begin does then if you tried to use both
BeepPin2::begin() you’d end up calling the audio initialisation code twice.
By having it separate:
- You can be sure to only initialise general audio only once
- Audio libraries don’t have to concern themselves with whether audio is enabled or disabled, or what the mechanism for determining that is
- I.e. they don’t need to know about EEPROM, let alone which flag is responsible for determining if audio should be enabled - see “Separation of Concerns”
Either way, it’s not an issue when using
arduboy.begin(), you only need to know about
audio.begin() if you’re not using