-
Notifications
You must be signed in to change notification settings - Fork 193
Description
Since some years, updateAudio() can be platform independent in so far as scaling to the required audio resolution can be done, automatically.
Where we still have differences is analog (audio or non-audio) input. mozziAnalogRead(), and getAudioInput() return values in a platform specific range. It should be possible to address this quite easily, by adding another configuration define like:
#define MOZZI_ANALOG_READ_RESOLUTION 12
All ports will then either have to make sure they perform reads at that resolution, or they can set some internal define telling what resolution analog reads actually have, internally. Then mozziAnalogRead() and getAudioInput() can trivially return values that have been shifted, accordingly.
So far so good. What I'd like to pick your brains about: What should be the default behavior, when users do not set MOZZI_ANALOG_READ_RESOLUTION? Essentially, I think the options are:
- Continue to return reads in platform specific resolution -> what we have now.
- Return reads at 10 bits resolution -> the default on classic AVR. Breaks some sketches (those written specifically for other platforms), fixes some sketches (those written for AVR, but used on other platforms)
- Return reads at 16 bits resolution -> enough room on all platforms, without exceeding uint16_t range. Breaks existing sketches, however.
Thoughts?