Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start audio DMA only in apps that use audio #1982

Merged
merged 3 commits into from
Mar 13, 2024

Conversation

NotherNgineer
Copy link
Contributor

@NotherNgineer NotherNgineer commented Mar 13, 2024

Moved the audio DMA initialization from the main baseband init function to the individual background processes that actually use audio, and only enable the DMA engine for the audio direction(s) needed. Also renamed the old baseband main.cpp module to indicate that it's unused/obsolete.

Effect:

  • Saves 9KB of ROM space (by not including unneeded DMA code in the apps that don't use audio, and only including the code for the direction needed [audio input or output]).
  • Saves a tiny bit of memory bandwidth in apps that don't use audio (now the DMA engines won't be continually transferring data between the circular audio buffers and the audio codec unnecessarily in such apps).

Note: There seems to be no actual synchronization between the M4 CPU filling the audio buffers and the DMA engine transferring the data to the codec, so PortaPack audio quality is rather poor and there's a slight risk that the audio quality may become worse due to timing whenever the background audio code is modified. There is a separate issue on audio quality that I'm still investigating.

Test version available here:
https://discord.com/channels/719669764804444213/722101917135798312/1217309730192621599

@NotherNgineer NotherNgineer marked this pull request as ready for review March 13, 2024 03:12
@NotherNgineer NotherNgineer changed the title Start audio DMA engines only in apps that use audio Start audio DMA only in apps that use audio Mar 13, 2024
Copy link
Member

@gullradriel gullradriel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to go !

@gullradriel gullradriel merged commit 0b2d5f7 into portapack-mayhem:next Mar 13, 2024
3 checks passed
NotherNgineer added a commit to NotherNgineer/portapack-mayhem that referenced this pull request Mar 13, 2024
@NotherNgineer NotherNgineer deleted the baseband-audio branch March 13, 2024 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants