* Added buffer read to `AudioBufferManager` and `I2S`. Example and documentation included.
* Update type of words to unsigned in example.
* Improve buffered loopback example.
* Remove const from read buffer.
The memcpy-version of the ABM::write updated the destination and count
but neglected to move the source forward. If a block write crossed a
frame boundary then the 2nd frame would repeat the data from the first
half of the buffer.
Fix by incrementing the source pointer by the same amount as was written.
Optimize AudioRequestBuffer writing when large blocks are available (i.e.
I2S writes of full MP3 or AAC frames in BackgroundAudio). Update I2S to use
the new call. Reduces 1152 calls to arb::write() to a single call/return
and optimized memcpy in that case.
Fixes#2188
We get a call to stop the audio channel from a timer/IRQ context, so can't
safely remove the IRQ handler for the AudioBufferManager. The SDK will panic.
Because the IRQ handler will be a noop if it's not uninstalled, we will
instead just leave our shared handler in place and let it do nothing.
Use a common BluetoothLock RAII in BluetoothAudio to clen up the code and
automatically lock BT for the AVRCP button methods.
The ABM had an off-by-one error in the DMA buffer swapover. Instead of
setting the DMA address to the newly added buffer in active[], it set it
to the buffer that was currently running.
This would effectively disable the ping-pong and cause clicks/lost data.
Fixes#1491
Mimics the I2S/PWMAudio/Stream interface for ease of use.
* Fix non-32b DMA size transfer calculation in ABM
* Rename wasHolding to isHolding in the I2S/PWM
It is the **current** number of bits left, not the past number.
* Add commented microphone example
* Add docs
Use the PWM hardware to generate a signal suitable for filtering and
amplifying 16bps audio output.
Refactor the AudioBufferManager to allow sharing with I2S
Add example