samd: When possible, use one DMA channel for stereo AudioOut #2552
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
.. the documentation doesn't make this clear, but in practice it works to write both of the DATABUF registers at the same time. This should also reduce the amount of wear and tear DMA puts on the system, as the number of transfers is cut in half. (the number of bytes transferred remains the same, though)
In principle, this could cover all stereo cases if audio_dma_convert_signed also learned to 16-bit extend and swap values. However, this is the case that matters for stereo mp3 playback on PyGamer.
Testing performed: Listened to some tracks with good stereo separation.
This will end up conflicting with #2533, which should be rebased if this is accepted first. In fact, if this is accepted, then in lieu of #2533 it is probably better to extend audio_dma_convert_signed and ditch the sibling dma channel code. Other parts of that PR would still apply, as far as getting rid of the "single channel" flags through the audio stack.