The BCK and WS pins aren't needed or used when using the I2SNoDAC
option. Restore their settings to whatever they were before, leaving
them untouched. Apps may configure the additional pins either before or
after the I2SNoDac is created.
The I2S outputs were converting samples in the buffer passed in
from u8->s16 on every call. When the I2S was full, however, the
sample would not get pushed and the output function would be
called at a later time with the same buffer...which was already
at 16 bits. It'd be converted again and turned into a high
frequency noise on the output.
Now only modify a copy of the input sample in I2S and I2SNoDAC.
Fixes the conversion problem competely.
Fixes#2
With the multiple I2S modes on the ESP32, it makes sense to use a
cleaner class hierarchy for the I2S tools. Make I2SNoDAC into a
subclass of I2S (renamed from I2SDAC) and remove about 80% of the
code which was identical exept for the per-sample bitstream synthesis.
The original I2S setup had the wrong # of bits being sent to the DAC
as well as wrong timeouts specified on the write_sample wrappers.
Fix those, allowing things like WebRadio.ino to work.
A new SetGain(float 0.0 ... 4.0) method can scale the output volume of
an I2S DAC or SW DAC by scaling the samples. Proper clipping is performed.
Adds a 16x16 multiply and a couple shifts/branches to every sample output.